How would I make a trigger that moves an object? I am making a horror game and I want it so once the player reaches a certain point a shadow moves across the road in front of them.
Easy way to do this is with a .Touched event on a part.
Script in ServerScriptService
local trigger = workspace:FindFirstChild("TriggerBlock"); local spooky = workspace:FindFirstChild("Spooky"); local start, stop = workspace:FindFirstChild("Start"), workspace:FindFirstChild("Stop"); trigger.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then spooky.CFrame = start.CFrame; game:GetService("TweenService"):Create(spooky, TweenInfo.new(1), {CFrame = stop.CFrame}):Play(); --The one represents one second, or how long it will take "spooky" to run across the hall, CFrame = stop.CFrame will make spooky run from start.CFrame to stop.CFrame in 1 second. end; end);
If this helped, please mark it as the solution so people know your question has been answered, and if you have other questions feel free to ask.