In my moon animator animation, I have particles that I wanted to play for the player, but they don’t play for the player. How can I make them play for the player?
local tool = script.Parent
local player = game.Players.LocalPlayer
local UserInputService = game:GetService("UserInputService")
local character = player.Character
humanoid = character:WaitForChild("Humanoid")
local flamethrowerAnimationId = "rbxassetid://18250242619"
local flamethrowerAnimation = Instance.new("Animation")
flamethrowerAnimation.AnimationId = flamethrowerAnimationId
flamethrowerAnimInstance = humanoid:LoadAnimation(flamethrowerAnimation)
local humanoid = nil
--local flamethrowerAnimInstance = nil
local function equipped()
print("Equipped")
if character then
humanoid = character:WaitForChild("Humanoid")
if humanoid then
end
end
end
local function unequipped()
print("Unequipped")
if flamethrowerAnimInstance then
flamethrowerAnimInstance:Stop()
end
end
local function onInputBegan(inputObject)
if inputObject.KeyCode == Enum.KeyCode.Q then
print("Q key pressed")
if flamethrowerAnimInstance then
flamethrowerAnimInstance:Play()
else
print("Flamethrower animation instance is not loaded.")
end
end
end
tool.Equipped:Connect(equipped)
tool.Unequipped:Connect(unequipped)
UserInputService.InputBegan:Connect(onInputBegan)