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

Stats Value adding / subtracting script not working why?

Pretty much this is a obstacle course game.

This is a TextButton that allows you to skip a Stage.

What the player needs is atleast 1 Skip which is a PlayerStat

If the Player has one skip and clicks this then it subtracts 1 skip and adds 1 Stage.

Both of these are Statistics Values.

Skips = game.Players.LocalPlayer.PlayerStats.Skips
Stage = game.Players.LocalPlayer.PlayerStats.Stage

if Skips.Value >= 1 then
	Stage.Value = Stage.Value +1
	wait(.1)
	Skips.Value = Skips.Value -1	
end

2 comments

0

Is this the entire script?

0

yes.

1 answer

✓ Accepted answer

To collect input from a TextButton, you need to use the MouseButton1Down or MouseButton1Click events, like this:

Skips = game.Players.LocalPlayer.PlayerStats.Skips
Stage = game.Players.LocalPlayer.PlayerStats.Stage

script.Parent.MouseButton1Click:connect(function()
	if Skips.Value >= 1 then
	    Stage.Value = Stage.Value +1
	    wait(.1)
	    Skips.Value = Skips.Value -1    
	end
end)

(I assume this is the problem)

2 comments

0

OMG I FORGOT about that why ! omg thank you so much ! lol i feel dumb now brainfarts are quite insane right now i am mindblown lol

0

Don't just assume you know the problem. If you answer, be sure about your answer.

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