When I click the head, it does nothing. I have my click detector in the Head and everything seems to be fine. No error messages but nothing happens. Here is the script:
local Button = script.Parent function onClick() local Player = Brick.Parent:findFirstChild("Humanoid") if (Player ~= nil) then local Location = game:GetService('Players'):GetPlayerFromCharacter(Player.Parent) local Button = Location.leaderstats.Gold if Location.leaderstats.Gold.Value > 19 then Location.leaderstats.Gold.Value = Location.leaderstats.Gold.Value - 20 script.Parent.Parent.Name = Player .. "'s House" end end end Target.ClickDetector.MouseClick:connect(onClick)
local Button = script.Parent function onClick() local Player = Brick.Parent:findFirstChild("Humanoid") -- what is "Brick"!! Define it. if (Player ~= nil) then local Location = game:GetService('Players'):GetPlayerFromCharacter(Player.Parent) if Location:WaitForChild("leaderstats").Gold.Value >= 19 then for i = 1,1 do Location:WaitForChild("leaderstats").Gold.Value = Location:WaitForChild("leaderstats").Gold.Value - 20 script.Parent.Parent.Name = Player .. "'s House" end end end end Button.ClickDetector.MouseClick:connect(onClick) -- What was target, Define it!!
I changed a couple things to work out, you also used the same variable "Button" twice also.
Also if you can figure out brick and define it, then your problem is solved. also Target.
If this helped +1 and if I answered your question check mark :)