Answers for "if part is touched"

Lua
0

if part is touched

--example if something is touched like a part. it is gonna do something to the humanoid

local part = script.Parent  --this is the part... put the script in the part


part.Touched:Connect(function(player)   --this is when the player touched the brick. we are also gonna name it player
	local hum = player.Parent:FindFirstChildWhichIsA("Humanoid") --here we gonna check the humanoid
	if hum then -- here we gonna check if it is a humanoid
		--code: example... you can change the health, walkspeed , jumpspeed and more
	end
end)
Posted by: Guest on February-04-2022

Code answers related to "if part is touched"

Browse Popular Code Answers by Language