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)
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)
How would I put the accessory into the code? Or ID?
If you're trying to use an accessory from the catalog, there are several plugins you can use to automatically import catalog items. I personally use one called "EasyInsert"
I see now
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.
You’d have to use the Humanoid:AddAccessory() function
This won't work. LocalPlayer only exists on LocalScripts, and this should be done in a normal script because you would want everybody on the server to see someone's accessory. Also, Clone doesn't take in any arguments
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
use instance.new