local debounce = false
script.Parent.ClickDetector.MouseClick:Connect(function()
01 | if debounce = = false then |
02 |
03 | debounce = true |
04 |
05 |
06 |
07 | -- I Don't Know What To Put Here |
08 |
09 |
10 | debounce = false |
11 |
12 | 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 ()
01 | local debounce = false |
02 |
03 | script.Parent.ClickDetector.MouseClick:Connect( function (player) |
04 | if not debounce then |
05 | debounce = true |
06 | player.Character.Humanoid:AddAccessory(game.ServerStorage.accessory:Clone()) -- clone the accessory or it won't be available to others in the game |
07 | wait( 1 ) |
08 | debounce = false |
09 | end |
10 | end ) |
I would imagine you have your accessories in server storage so:
01 | local debounce = false |
02 | local accessory = game.ServerStorage.tophat -- this is an example, just put your hat or whatever there |
03 | script.parent.MouseClick:Connect( function () |
04 | if debounce = false then |
05 | debounce = true |
06 | accessory:Clone(game.Players.localplayer.Character) |
07 | wait( 1 ) |
08 | debounce = false |
09 | end |
10 | end ) |
I'm not a expert on this, but this should work.