Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How can I make a move trigger?

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.

1 answer

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.

3 comments

0

So, i'd name the object I want to move "Spooky" or replace "Spooky with the objects name?

0

Okay, I have my jumpscare placed and named "Spooky", I have 2 parts named "Stop" and "Start" and have placed them in position of where i'd like the jumpscare to head. I have placed a transparent and non-collideable "TriggerBlock" and have set it up but Spooky won't move.

0

All 4 parts are just children of workspace correct?

This discussion is preserved as it was. New answers, comments, and votes are closed.