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

My CFrame jumpscare script won't work and i'm not sure what's wrong, can someone help me out?

I am currently making a horror game and i'm trying to make a jumpscare of a person quickly running across the road. Someone helped me earlier but I can't get it to work.

I have this script in my ServerScriptStorage

local trigger = workspace:FindFirstChild("JumpTrigger");
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}); --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);

I have my model named "Spooky" set up in the right spot aswell as 2 parts named "Start" and "Stop" on both sides of the road with the trigger being a transparent noncollideable block stretching across the road named "JumpTrigger".

I have been messing around and I still can't get it to work so maybe someone can help me fix it.

2 comments

0

any errors?

0

No, there are no errors.

1 answer

Sorry, I thought I did it but just looked. I created the Tween, but we aren't playing it

local trigger = workspace:FindFirstChild("JumpTrigger");
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);

Updated code to Play() the tween as I forgot before.

2 comments

0

No, it won't work. He said that on Discord.

0

He said calling Play on the created tween does nothing? Because I made the original code for his question before. I forgot to have the :Play() to actually run the Tween.

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