I'm trying to make a script that when the player clicks "T" it not only starts an animation but it enables the particles that are already placed in the character and have been disabled. Scripts not working any help ?
``local UserInputService = game:GetService("UserInputService") local Player = game.Players.LocalPlayer local Character = Player.Character local Humanoid = Character:WaitForChild("Humanoid") local Animation = Instance.new("Animation") Animation.AnimationdID = "rbxassetid:2866299208" local track = Humanoid:LoadAnimation(Animation)
local particle = Character:WaitForChild("LeftUpperArm"):WaitForChild("ParticleEmitter") local particle1 = Character:WaitForChild("RightLowerArm"):WaitForChild("ParticleEmitter") local particle2 = Character:WaitForChild("RightUpperLeg"):WaitForChild("ParticleEmitter") local particle3 = Character:WaitForChild("UpperTorso"):WaitForChild("ParticleEmitter")
UserInputService.InputBegan:Connect(function(input, proc) if not proc and input.KeyCode == Enum.KeyCode.T then particle.Enabled = true particle1.Enabled = true particle2.Enabled = true particle3.Enabled = true track:Play() wait(3) track:Stop() end end)``
Since you're not wait
ing for the Character it might be broken because of that.
Or it is because you misspelled AnimationId
at Animation.AnimationdID = "rbxassetid:2866299208"
.
It could be because you misspelled the link "rbxassetid:2866299208"
, it should be "rbxassetid://2866299208"
.
Here's the fixed script:
local UserInputService = game:GetService("UserInputService") local Player = game.Players.LocalPlayer local Character = Player.Character or Player.CharacterAdded:wait() local Humanoid = Character:WaitForChild("Humanoid") local Animation = Instance.new("Animation") Animation.AnimationId = "rbxassetid://2866299208" local track = Humanoid:LoadAnimation(Animation) local particle = Character:WaitForChild("LeftUpperArm"):WaitForChild("ParticleEmitter") local particle1 = Character:WaitForChild("RightLowerArm"):WaitForChild("ParticleEmitter") local particle2 = Character:WaitForChild("RightUpperLeg"):WaitForChild("ParticleEmitter") local particle3 = Character:WaitForChild("UpperTorso"):WaitForChild("ParticleEmitter") UserInputService.InputBegan:Connect(function(input, proc) if not proc and input.KeyCode == Enum.KeyCode.T then particle.Enabled = true particle1.Enabled = true particle2.Enabled = true particle3.Enabled = true track:Play() wait(3) track:Stop() end end)
I don't know your intentions, but you also might want to disable the particles at the end of the animation.