Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Textbutton GUI not giving tool? [SOLVED]

The TextButton is supposed to teleport a player to one of five positions, remove the TextButton so they can't TP away if they're about to die, FF them for 5 seconds, and then give them a tool "EnergySword" which is located in lighting. Everything works except for giving the tool part

wait() math.randomseed(tick())
local player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:connect(function()
player.Character:MoveTo(workspace['spawn'..math.random(5)].Position)
script.Parent.Visible = false
local f = Instance.new('ForceField',player.Character)
coroutine.wrap(function() wait(5) f:Remove() end)()
end)

script.Parent.MouseButton1Click:connect(function(player)
  local EnergySword = game.Lighting.EnergySword:Clone()
	game.Lighting["EnergySword"]:clone().Parent = player:FindFirstChild("Backpack")

end)

1 answer

✓ Accepted answer

I think the problem is that you declared player as a variable and a parameter. I suggest changing player to plr for the parameter for this line:

script.Parent.MouseButton1Click:connect(function(player)

This discussion is preserved as it was. New answers, comments, and votes are closed.