local debounce = false
script.Parent.ClickDetector.MouseClick:Connect(function()
if debounce == false then debounce = true -- I Don't Know What To Put Here debounce = false end
end)
ClickDetectors pass in the player that clicks on it as a parameter. You can use it by creating your function with (player)
instead of just ()
local debounce = false script.Parent.ClickDetector.MouseClick:Connect(function(player) if not debounce then debounce = true player.Character.Humanoid:AddAccessory(game.ServerStorage.accessory:Clone()) -- clone the accessory or it won't be available to others in the game wait(1) debounce = false end end)
I would imagine you have your accessories in server storage so:
local debounce = false local accessory = game.ServerStorage.tophat -- this is an example, just put your hat or whatever there script.parent.MouseClick:Connect(function() if debounce = false then debounce = true accessory:Clone(game.Players.localplayer.Character) wait(1) debounce = false end end)
I'm not a expert on this, but this should work.