I have a sword in lighting and have this as a local script in a text button
local button = script.Parent button.Selected = true local player = game.Players.LocalPlayer local starterSword = game.lighting.ClassicSword function onClicked() if button.Selected == false then script.Parent.Parent.Parent.Enabled = false local playersword = starterSword:Clone() playersword.Parent = player.Backpack button.Selected = true elseif button.Selected = false end end
This is my script but nothing happens
You had a few simple mistakes in your script, so I fixed it for you! Here is the result:
local button = script.Parent button.Selected = true local player = game.Players.LocalPlayer local starterSword = game.Lighting.ClassicSword function onClicked() if button.Selected == false then script.Parent.Parent.Parent.Enabled = false local playersword = starterSword:Clone() playersword.Parent = player.Backpack button.Selected = true else button.Selected = false end end end
**If this worked, accept the answer, so we both can get reputation :) **