local ClickDetector = script.Parent ClickDetector.MouseClick:Connect(function() game.Workspace.WoodenSword.Parent = game.StarterPack local player = game.Players.LocalPlayer player.Health = 0 end)
✓ ANSWER ACCEPTED
Refresh player onclick ?
2 answers
✓ Accepted answer
Hello there!
Issues
LocalPlayer can't be used in a ServerScript as they run on a physical server, no the client.
Use
player.Backpackinstead ofgame.StarterPackas StarterPack is the container for starter tools. The backpack is the container for the tools in a player.
How to fix it
Use the parameter of MouseClick, which is the player who clicked it. Then, load the character of that player using Player:LoadCharacter(), and then set the wooden sword's parent to the player's backpack.
Fixed Code
script.Parent.ClickDetector.MouseClick:Connect(function(player)
player:LoadCharacter()
workspace.WoodenSword.Parent = player.Backpack
end)
Please upvote and accept my answer if it helped.
script.parent.ClickDetector.MouseClick:Connect(function()
local Player = game.Players.LocalPlayer
local Char = Player.Character
Char:LoadCharacter()
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Is this the full script? Also, use the lua button on the top, and paste your code between the lines.(this makes it much easier to read) After this, I may be able to help you.