Okay so I'm super bored. I can't figure out how to fix my game I'm working on so I decided to make just a fun little simple game. So I was thinking of some game ideas. I then thought of making Helmet in roblox. If you don't know Helmet its a old game from the 80s in the Game & Watch series. You can google it if you need to. But when you do it you get like 6 points so I made a leaderstat but I don't know how to make a brick give you 6 points on touch.
LEADERSTATS SCRIPT:
game.Players.PlayerAdded:Connect(function(player) local leaderstats = Instance.new("Folder") leaderstats.Name = "leaderstats" leaderstats.Parent = player
local points = Instance.new("IntValue") points.Name = "Points" points.Parent = leaderstats
end)
I'm assuming you have to touch the block.
local block = game.workspace.block block.Touched:Connect(function(touch) local human = touch.Parent:FindFirstChild("Humanoid") if human then local plr = human.Parent:GetPlayerFromCharacter() plr.leaderstats.points.Value = plr.leaderstats.points.Value + 6 end end)
Okay so I found a answer so I was playing around seeing if I could fix this and here is the script to fix it:
game.Players.PlayerAdded:Connect(function(player) local debounce = true script.Parent.Touched:Connect(function() local plrstats = player.leaderstats.Points if debounce then debounce = false plrstats.Value = plrstats.Value +6 wait(2) debounce = true end end) end)