Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 4 years ago

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.

0
any errors? Luka_Gaming07 534 — 4y
0
No, there are no errors. onehappypie 5 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

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.

0
No, it won't work. He said that on Discord. Block_manvn 395 — 4y
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. MrLonely1221 701 — 4y
Ad

Answer this question