How do I get the clicker giver to dispense a tool only one time. I tried this code but doesn't work.
playerNameList = {} function onClicked(player) local playerName = player.Name local executeFunction = true; --Check to see if the player has clicked before --This will not execute if the value is false or nil. if(playerNameList[playerName]) then executeFunction = false; end if(executeFunction) then function onClicked(part) local player = game.Players.LocalPlayer local giver = game.Players:FindFirstChild(""..player.Name.."") print("Clicked") if player ~= nil then local wep = game.Lighting.SCAR:clone() -- Change NAME to your model name and put it in the Lighting. wep.Parent = giver.Backpack end end script.Parent.ClickDetector.MouseClick:connect(onClicked) end playerNameList[playerName] = true end script.Parent.ClickDetector.MouseClick:connect(onClicked)