local debounce = false
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local character = player.Character or player.CharacterAdded:Wait()
local animInstance = Instance.new("Animation")
local humanoid = character:WaitForChild("Humanoid")
animInstance.AnimationId = "rbxassetid://6380434675"
local anim = humanoid:LoadAnimation(animInstance)
local Col = game:GetService("CollectionService")
local tag = Col:GetTagged("Rain")
local torso = game.Workspace:FindFirstChild(player.Name)
mouse.KeyDown:connect(function(key)
if key == "e" then
if not debounce then
anim:Play()
for _, TaggedPart in pairs(tag) do
for count = 1, 5 do
local part = tag:Clone()
part.Parent = game.Workspace
part.Position = torso.UpperTorso.Position +(torso.UpperTorso.CFrame.lookVector*5) + Vector3.new(0,20,0)
debounce = true
wait(0.1)
debounce = false
end
end
end
end
end)
COMMUNITY QUESTION
My script is not working for LocalScript:18: attempt to call a nil value line 18?
1 answer
You have to say 'TaggedPart'. Like this:
for _, TaggedPart in pairs(tag) do
for count = 1, 5 do
local part = TaggedPart:Clone() -- You have to say 'TaggedPart'
part.Parent = game.Workspace
end
Hope it helps
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
(humanoid):LoadAnimation is a deprecated function. You should not use it for your scripts. Use the Animator child of the Humanoid instead.