So i tried to make a button, that gives you weapon from Lighting if it is not already in you backpack. But as usually it is not working. Can someone tell me what is wrong with this.
So it is part. Inside that part is this script, StringValue named Value and ClickDetector. There is tool called "Key" in Lighting. StringValue value is "Key".
function onClicked(Player) local found = Player.Backpack:FindFirstChild((script.Parent.Value.Value)) if not found then local Item=game.Lighting(script.Parent.Value.Value):Clone() Item.Parent=Player.Backpack end end script.Parent.ClickDetector.MouseClick:connect(onClicked)
Instead of
local Item=game.Lighting(script.Parent.Value.Value):Clone()
Use this instead? I don't see any errors in the script.
local Item=game.Lighting:WaitForChild(script.Parent.Value.Value):Clone()