Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I make a block that gives you points?

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)

1 comment

0

I'm done I don't know how to type down scripts

2 answers

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)

3 comments

0

Yes when the player touchs the block it is suppose to give 6 points. I'm suppose to put this inside the part correct? Because thats what I did and it did not work.

0

he did something wrong on line 6, its supposed to be "local plr = game.Players:GetPlayerFromCharacter(human.Parent)"

0

and also you need to add a debounce so the points dont skyrocket. u can google that up for help

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)

1 comment

0

It won't allow me to answer my own question lol.

This discussion is preserved as it was. New answers, comments, and votes are closed.