-- Create a variable to store the part
local loopingPart = game.Workspace.LoopingPart
-- Looping Code
while true do
-- Changes loopingPart's color
loopingPart.BrickColor = BrickColor.new(0.7, 0.9, 0.9)
-- Wait 3 seconds before next instruction
wait(3)
loopingPart.BrickColor = BrickColor.new(0.9, 0.4, 0.9)
wait(3)
loopingPart.BrickColor = BrickColor.new(0.4, 0.5, 0.4)
wait(3)
end
-- Changes the color of loopingPart every few seconds
-- Create a variable to store the part
local loopingPart = script.Parent
-- Looping Code
while true do
-- Changes loopingPart's color
loopingPart.BrickColor = BrickColor.new(0.7, 0.9, 0.9)
-- Wait 3 seconds before next instruction
wait(3)
loopingPart.BrickColor = BrickColor.new(0.9, 0.4, 0.9)
wait(3)
loopingPart.BrickColor = BrickColor.new(0.4, 0.5, 0.4)
wait(3)
end
-- Prints your favorite food
local function printFood()
print("Curry!")
end
printFood()
-- Checks for player touch. If true, sets health to 0
-- Variable setup
local part = script.Parent
-- Checks for Humanoid in otherPart
local function onTouch(otherPart)
-- Store parent of otherPart
local character = otherPart.Parent
-- Looks for a humanoid
local humanoid = character:FindFirstChildWhichIsA("Humanoid")
if humanoid then
-- If part has humanoid, set health to 0
humanoid.Health = 0
end
end
-- Connect the Touched event to onTouch
part.Touched:Connect(onTouch)
-- Destroys whatever touches the parent
-- Variable setup
local trap = script.Parent
-- Gets an object to destroy
local function onTouch(objectTouched)
-- Destroy objectTouched
print("Something touched the trap part")
objectTouched:Destroy()
end
-- Connects onTouch() to Touched event
trap.Touched:Connect(onTouch)