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

Textbutton GUI not giving tool? [SOLVED] [closed]

Asked by
Agios 10
9 years ago

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)

Locked by NotsoPenguin, Shawnyg, and EzraNehemiah_TF2

This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.

Why was this question closed?

1 answer

Log in to vote
0
Answered by 9 years ago

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)
Ad