WaitForChild is not a valid member of RBXScriptSignal?

Just got this error with my tools but it only does this when my tools are loaded via a data store it works so when u buy a tool from the shop it saves to your inventory so u dont buy it again it works normally when you buy the tool and use it but when you rejoin and get the tool back it gives this errorYes1
I have no idea what RBXScriptSignal is or what it does and i dont know why its erroring ive never had this happen before so please tell me what is wrong heres is the code from one of my tool scripts.

Simple speed tool script:

local tool = script.Parent.Parent
local player = game.Players.LocalPlayer.Character
local hum = player:WaitForChild("Humanoid")
local anim = script:WaitForChild("Animation")
local loadedAnim = hum:LoadAnimation(anim)
tool.Activated:Connect(function()
	hum.WalkSpeed = 50
	loadedAnim:Play()
end)

tool.Unequipped:Connect(function()
	hum.WalkSpeed = 16
	loadedAnim:Stop()
end)

Are you sure that you reference the tool variable correctly? Also, the player variable you have will only detect the current Character (Which I don’t know why you’d do that as it’s confusing)

Just do something like this:

local tool = script.Parent.Parent
local player = game.Players.LocalPlayer
local Character = player.Character or player.CharacterAdded:Wait()

local hum = Character:WaitForChild("Humanoid")
local anim = script:WaitForChild("Animation")
local loadedAnim = hum:LoadAnimation(anim)
tool.Activated:Connect(function()
	hum.WalkSpeed = 50
	loadedAnim:Play()
end)

tool.Unequipped:Connect(function()
	hum.WalkSpeed = 16
	loadedAnim:Stop()
end)
1 Like