I am scripting a Swordgiver that when a button is pressed it will give a sword. But I do not know what to put into the player variable because Players.Localplayer only works on local scripts I am doing this with a text button. if there isn't a way to do this can someone tell me another way
local ClassicSword = game.ServerStorage.ClassicSword local part = script.Parent local canGet = true
local function onTouch() local Player = local Char = Player.Character local SwordClone = ClassicSword:Clone() SwordClone.Parent = Char end part.MouseButton1Click:Connect(onTouch)

3 comments
Are you using a Text Button on a SurfaceGUI?
Why are you using MouseButton1Click on a part?
the part is just a variable equal to the text button