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

Tool Equipped event not firing?

Asked by 8 years ago

Hierarchy goes like this:

-Tool -Script -Particles (THIS IS A FOLDER!) -AuraParticle

repeat wait() until game.Players.LocalPlayer:WaitForChild("Character")~= nil

local tool = script.Parent
local aura = tool.Particles:FindFirstChild("AuraParticle")
local plr = game:GetService("Players").LocalPlayer
local char = plr:FindFirstChild("Character")
local la = char:FindFirstChild("Left Arm")
 local ra = char:FindFirstChild("Right Arm")

local function auraArms()
    print("Aura Arms activated!")
end

tool.Equipped:connect(auraArms)

It just doesn't want to do anything, no errors are in the output either. The tool doesn't have require a handle so that property is false, and that's really the only thing I changed in the properties of the tool.

1 answer

Log in to vote
0
Answered by
BlackJPI 2658 Snack Break Moderation Voter Community Moderator
8 years ago

Character is not a child of LocalPlayer, but is rather a property. Therefore your WaitForChild call will most likely never stop yielding. If you want to wait until the character is added, you could do something like this:

local player = game.Players.LocalPlayer 
if not player.Character then
    player.CharacterAdded:wait()
end
local character = player.Character
0
I'll try this, if it works, you sir are getting an upvote. Strykebyte 45 — 8y
0
It worked, thank you! Strykebyte 45 — 8y
0
No problem :) BlackJPI 2658 — 8y
Ad

Answer this question