Values not changing?

Hey! Thanks for looking at my problemo! :slight_smile:

Basically I’m trying to add values together and they don’t add, or get removed when I’m clearly telling it to. It’s being done with FE enabled but I don’t believe that thats the problem.

Heres my localscript:

 script.Parent.MouseButton1Click:connect(function()

 game.ReplicatedStorage.GiveEvent:FireServer()

 script.Parent.Parent.Parent:Destroy()

 end)

And my serverscript:

 game.ReplicatedStorage.GiveEvent.OnServerEvent:Connect(function(plr)

 plr.Stats.Coins.Value = plr.Stats.Coins.Value + plr.Stats.CurrentStorage.Value * 
 plr.Stats.Multiplier.Value

 plr.Stats.CurrentStorage.Value = 0

 print('done')

 end)

First of all, can I just say that connect is depreciated, you should be using Connect instead.

Does it print done in the end?
You should try to print out each of those values you’ve indexed individually to see any anomalies .

Yes, It does print done, and I’ll switch to Connect. But what do you mean by your 3rd argument?

Print each of these out

Before or after (or both) I the remote is fired?

You could do it on both sides to see its to do with a problem with the server not being able to see your values.
I believe you should be making your IntValues on the server so that both the player and the server can see it - since its in FE.

Are you values NumberValues? Make sure plr.Stats.Multiplier.Value is not 0. That’s the only reasons I can find. UwU

The IntValue is created on the server. (Heres a photo of the (glitch?) happening:

< That is with no changes yet.

They are IntValues, and the multiplier is 1. The values simply do not change.

Have you tried to declare

These as variables before changing the values?

local Stats = plr.Stats
local Coins = Stats.Coins.Value
local CurrentStorage = Stats.CurrentStorage.Value
local Multiplier = Stats.Multiplier.Value

Coins = Coins + CurrentStorage * Multiplier

CurrentStorage = 0
print(`done`)

My only guess now it could be your variables. One time I had an issue with a calculation not going through because I didn’t use variables.
Plus, use brackets to indicate what you’re actually multiplying?

I have not tried the following yet… But heres something very odd…

And no, the variables didn’t work either. What If I reference the values on the client side and told them to change on the server side of things?

Try to change the values on the server side

Nope… ;/ I’m so stumped, and this is a players data I’m risking… Oof

When and where do you change CurrentStorage?

For testing, I use a clickdetector to fire a remoteevent (the same one im using for this?) that fires the client and gives currentstorage value successfully.

But obviously I’ll change that when I’m further on into the games development.

Where do you change the variable? I believe you’re only changing the value locally because from the last screenshot you sent was your clients IntValue because of the blue highlight around your ROBLOX window. You need to be changing the values on the server.

Server script (In the clickdetector part)

 local function c(plr)

 game.ReplicatedStorage.GiveEvent:FireClient(plr)

 end

 script.Parent.ClickDetector.MouseClick:Connect(c)

And then my local script:
game.ReplicatedStorage.GiveEvent.OnClientEvent:Connect(function(plr)

 script.Parent.Parent.Stats.CurrentStorage.Value = 10

 end)

So basically, I should be using a bindable event instead of a RemoteEvent, correct?

Wait- How would I get the players name from a ClickDetector?..

Edit: Nvm