[HELP] Simulator Scripts not Working Correctly

Is Totalclaps the value that is showing on the screen or is claps that value?

The value on the screen is total claps (i am still uploading the other videos)

After resetting the data store it works.
Roblox-2020-06-10-10-11-42

But when I join back…

Roblox-2020-06-10-10-12-54

I am going to rejoin again and see what happens.

Edit: It does the same thing, just multiplying by a different value.

So from what i can see, The “plus” value is getting bigger, can you print out the value of “Plus” everytime you clap

game:GetService("ReplicatedStorage").GiveCoins.OnServerEvent:Connect(function(player)
	player.leaderstats.Claps.Value = player.Plus.Value * 10 + player.leaderstats.Claps.Value
	player.totalClaps.Value = player.Plus.Value * 10 + player.totalClaps.Value
print(player.Plus.Value)
end)

It’s either the script’s math is wrong or the plus value is constantly being made big.

2 Likes

Try change this code:

if success and data then
	Claps.Value = data[1]
	Level.Value = data[2]
	Plus.Value = data[3]
	Money.Value = data[4]
	totalClaps.Value = data[5]
	KeyLevel.Value = data[7]
else
	print("Data not found")
end
end)

to this:

if success and data then
	Level.Value = data[2]
	Plus.Value = data[3]
	Money.Value = data[4]
	totalClaps.Value = data[5]
    Claps.Value = data[1]
	KeyLevel.Value = data[7]
else
	print("Data not found")
end
end)
1 Like


Ok so how could I fix this.

Edit: I will try what you said

You appear to be levelling up many times over, It has to be something to do with

if player.totalClaps.Value >= player.Plus.Value * player.Plus.Value * 1000 then

This line here, If we plug in ordinary values for it: PlusValue = 1, TotalClaps = 0 (when you first join)
you will get
if 0 >= 1000 then

Which means, at one point, your totalclaps is greater than your plusvalue formula.

Try printing at the level up

player.leaderstats.Claps:GetPropertyChangedSignal("Value"):Connect(function()
	if player.totalClaps.Value >= player.Plus.Value * player.Plus.Value * 1000 then
        print("LeveledUp")		
        local object = script.Parent.Frame
		levelUp:FireServer(player)
		object.Visible = true
		wait(2)
		object.Visible = false
	end
end)

(Sorry for making you do so many things, i don’t deal with massive amounts of code well)

1 Like

I changed the data store key again to a whole new one. And I didn’t even clap but my stats look like this…

You must’ve punched in a previous datastore code and that happened.

I just smashed my keyboard so I don’t think that is why.
image

If that’s not the case, you want to debug the clap and level up function,

Let me know once you’ve added the print to the levels what it says.

1 Like


Currently it is working fine I will get to the leveling up part and fill you in.

1 Like


After the level up everything works fine. I am going to rejoin and see if my data saves.


Everything saves except the money. This might be because of too many requests?

I rejoined a second time and the money is back to normal.

It’s not because of too many requests, it’s because the value isn’t saved properly.
If it’s due to too many requests, it would’ve not saved anything (You have everything saved in a table)

Is the issue not happening anymore? Also, I’d recommend using DataStore2 for handling you data, it has easy to use API and you will need to use it as to not surpass the datastore limit. as seeing as you store everything within a table.

1 Like

How would I save multiple pieces of data? And also would I have to go through all my code and change the leaderstats changing to Increment()

To save multiple pieces of data, you can use the “combine” function as to not run into any errors, and no, you don’t have to change it to increment, You can if you want but you don’t have to, as long as you save the player’s value when they leave.

1 Like