Im not able to fix a small bug, which should be easy to fix

so im not the best scripter, but i followed a tutorial for something i have done rarely, it worked somewhere in an other script but here i clearly dont know what to do. so the script is here :
image
and the code in it is:

local Animation = script.Animation
local Humanoid = script.Parent.Humanoid
local AnimationClip = Humanoid.Animator:LoadAnimation(Animation)

repeat wait() until game.Workspace.Triggers.JumpscareTriggers:FindFirstChild("JumpscareTrigger1")==nil
script.Parent = game.Workspace
wait()
AnimationClip.Looped=false
AnimationClip:Play()
--and well its not giving me an error but its also not working

and yes the object which is being waited for to be deleted gets deleted

Should be script.Parent.Parent = game.Workspace

okay, ima see if that works :smiley:


it didnt work

thats why im struggeling :confused: .

Oh I see. Scripts won’t run in ReplicatedStorage. I’d move your script to ServerScriptService. I’d also clone the Jump scare instead of moving the original. Also on line 2, “Animation” isn’t defined. Maybe it’s defined above. Not sure if you sent the whole script or not.

1 Like

Oh yeah, it is defined, i forgot to copy that line

repeat
script.Parent = game.Workspace
wait()
AnimationClip.Looped=false
AnimationClip:Play()
until game.Workspace.Triggers.JumpscareTriggers:FindFirstChild(“JumpscareTrigger1”)==nil


Tell me if this works or not

1 Like

from the looks of it it looks promising, but i have forgot to tell , its needed to play the animation after the part gets deleted

i have now changed up the location and the code a bit and still nothing happens :confused:
image

local Animation = script.Animation
local Humanoid = script.Parent.Humanoid
local AnimationClip = Humanoid.Animator:LoadAnimation(Animation)

repeat wait() until game.Workspace.Triggers.JumpscareTriggers:FindFirstChild("JumpscareTrigger1")==nil
script.Parent:Clone()
script.Parent.Parent = game.Workspace
wait()
AnimationClip.Looped=false
AnimationClip:Play()

Wait what triggers the script?

so
image

script.Parent.Touched:Connect(function(hit)
	if hit and hit.parent:FindFirstChild("Humanoid") then
		script.Parent:Destroy()
	end
end)

the script is wrong …so i just found out the newest version didnt save, my laptop crashed earlyer

the script is wrong …so i just found out the newest version didnt save, my laptop crashed earlyer

but in the newest version it also didnt load, the older version was me messing arround, trying to get the script working

Keep the Jumpscare in ServerStorage but move the script to ServerScriptService and keep the animation under it.

local Jumpscare = game.ServerStorage.Jumpscares.Jumpscare1
local Humanoid = Jumpscare.Humanoid
local Animation = script.Animation
local AnimationClip = Humanoid.Animator:LoadAnimation(Animation)

repeat wait() until game.Workspace.Triggers.JumpscareTriggers:FindFirstChild("JumpscareTrigger1")==nil
local JumpscareClone = Jumpscare:Clone()
JumpscareClone.Parent = game.Workspace
wait()
AnimationClip.Looped = false
AnimationClip:Play()
1 Like

Now I’m confused, so does our methods help? Does it solve your issue? Or do you need help with the current version you have? I want to see the current version you have so I can help.

2 Likes

every script which i posted got updated to the version that it crashed with

so the script seems like perfect, but while looking at ur script (yes the jumpscare finally gets moved)
you have messed up the part with the animation, but i think i can fix that