Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Can someone tell what is wrong with this?

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)

1 answer

✓ Accepted answer

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

This discussion is preserved as it was. New answers, comments, and votes are closed.