Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR LUA

roblox touch part kill script

local Part = script.Parent -- Assigning a variable to the part

Part.Touched:Connect(function(Object) -- Listening out for when the part is touched and if it is then we are given information about what object touched the part
	if Object.Parent:FindFirstChild("Humanoid") then -- Checking if it's a player (if the object was an arm then it would look into the parent and look for the humanoid)
		Object.Parent:FindFirstChild("Humanoid").Health = 0 -- Changes the health value in the humanoid to 0 so the player dies
	end -- The end of the if statement
end) -- The end of the function
Source by developer.roblox.com #
 
PREVIOUS NEXT
Tagged: #roblox #touch #part #kill #script
ADD COMMENT
Topic
Name
5+9 =