Hey, so I'm trying to make a hitbox thing damage IDK what to call it but anyways the script is meant to do this :D
If a player clicks a part 5 times they make the part get deleted and they receive currency/Money
But here's the problem how do I award a player with Money?
local HitValue = 0 script.Parent.ClickDetector.MouseClick:Connect(function() HitValue = HitValue + 1 print(HitValue) end) while HitValue < 10 do wait() if HitValue == 5 then script.Parent.Parent.TestingWoodPart:Destroy() end end
local HitValue = 0 local player script.Parent.ClickDetector.MouseClick:Connect(function(detected_player) HitValue = HitValue + 1 print(HitValue) player = detected_player end) while HitValue < 10 do wait() if HitValue == 5 then script.Parent.Parent.TestingWoodPart:Destroy() player.leaderstats.Money.Value = player.leaderstats.Money.Value + 1 --you can modify "Money" with the correct name or the value end end
https://developer.roblox.com/en-us/api-reference/event/ClickDetector/MouseClick
workspace.Baseplate.ClickDetector.MouseClick:Connect(function(player) -- Click detectors have a parameter for PlayerWhoClicked. When using function(player) you are able to get the player. print(player.Name) end)