I've been struggling on this for half an hour, I'm not sure how to get the character from a normal script. The script is located inside a tool.
script.Parent.Equip.Player.Value = game.Players:FindFirstChild(script.Parent.Parent.Parent.Name)
if not game.ReplicatedStorage:FindFirstChild("spellcast_event") then
script.Spellcast_event.Parent = game.ReplicatedStorage
script.Parent.Output.Disabled = false
else
script.Spellcast_event:Destroy()
script.Parent.Output.Disabled = false
end
wait(1)
script:Destroy()
And this is the script where I'm getting the error from.
When I equip: 23:08:54.482 - Players.BiIinear.Backpack.Spellcast.Equip:7: attempt to index global 'player' (a nil value) 23:08:54.483 - Stack Begin 23:08:54.483 - Script 'Players.BiIinear.Backpack.Spellcast.Equip', Line 7 23:08:54.483 - Stack End
When I unequip: 23:08:55.581 - Players.BiIinear.Backpack.Spellcast.Equip:13: attempt to index global 'player' (a nil value) 23:08:55.581 - Stack Begin 23:08:55.582 - Script 'Players.BiIinear.Backpack.Spellcast.Equip', Line 13 23:08:55.582 - Stack End
player = game.Players:FindFirstChild(script.Player.Value)
handle = script.Parent.Handle
script.Parent.Equipped:Connect(function()
handle.Ambience:Play()
local fire = handle.Firecast:Clone()
fire.Parent = player.Torso
fire.Enabled = true
end)
script.Parent.Unequipped:Connect(function()
handle.Ambience:Pause()
player.Torso:FindFirstChild("Firecast"):Destroy()
end)
Thanks in advance.
