In my game ive got a separate part of the map where players teleport and fight each other with weapons they choose from a gui that becomes visible when they teleport. the only problem is that when it comes to pressing the TextButton to give the weapon, it either gives me a broken tool or nothing at all.
local frame = script.Parent.Parent.Parent
local tool = ("Hammer")
local player = game.Players.LocalPlayer
repeat wait(0.1) until player.Backpack
script.Parent.MouseButton1Down:connect(function()
game.Lighting:FindFirstChild(tool):Clone().Parent = player.Backpack
frame:remove()
end)
This is a local script inside of a textbutton

1 comment
I also get the problem that if i did get the weapon, it would only be on my side, so i could go kill someone, but they would only die for me.