I have a person and when a player clicks it? No errors do appear. Any suggestions are appreciated!
local debounce = true local Click = script.Parent.ClickDetector Click.MouseClick:Connect(function(hit) local h = hit.Parent:FindFirstChild("Humanoid") if (h ~= nil and debounce == true) then debounce = false local p = script.Parent.Parent.Shirt:Clone() p.Parent = hit.Parent wait(1) debounce = true print("it works") end end)
You are not setting up your variables correctly for example this function returns the player not the character. Try the code i have provided for you below make sure its in a Script not a LocalScript.
Debounce = false function Clicked (player) if not Debounce then Debounce = true local Shirt = script.Parent.Parent:WaitForChild('Shirt'):Clone() Shirt.Parent = workspace:WaitForChild(player.Name) wait(1) Debounce = false print('It Works') end end script.Parent.ClickDetector.MouseClick:Connect(Clicked)