Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make a block that gives you points?

Asked by 4 years ago

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)

0
I'm done I don't know how to type down scripts Koley_Moley -7 — 4y

2 answers

Log in to vote
0
Answered by 4 years ago

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)
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. Koley_Moley -7 — 4y
0
he did something wrong on line 6, its supposed to be "local plr = game.Players:GetPlayerFromCharacter(human.Parent)" FirewolfYT_751 223 — 4y
0
and also you need to add a debounce so the points dont skyrocket. u can google that up for help FirewolfYT_751 223 — 4y
Ad
Log in to vote
0
Answered by 4 years ago

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)

0
It won't allow me to answer my own question lol. Koley_Moley -7 — 4y

Answer this question