Script not modifying cash value when part is touched

	if touch:FindFirstChild("Value") then
		local character = script.Parent.Parent.Parent.Owner.Value
		local plr =	game.Players:GetPlayerFromCharacter(character)
		local mult = plr.Multiplier
		local totalValue = touch.Value.Value * mult.Value
		plr.leaderstats.Cash.Value += totalValue
1 Like

What is the exact issue your having? Any errors in output? What’s the goal of this script? What is the scripts path?

no errors it is in a collecter in a tycoon.

Does the print work? Where is the issue occurring(what line does it stop at), try adding print(touch) and print(plr) so you know you’ve found the player.

It prints 1 it is supposed to print 1.5

That’s the error? It functions otherwise? Must be some issue with the leaderstat then, not the this script(assuming it functions otherwise).

everything works fine and the players multiplier is 1.5.

I’m sorry, I have no idea what isn’t working properly right now. Is the multiplier suppose to be 1.5? Is the multiplier not working?

From what you’ve said, the script works properly.

The players Multiplier IS 1.5 It just doesn’t print 1.5 it prints 1

That’s cause your not printing the mult value, your printing mult value * touch value. Under mult put print(mult.Value) and see what happens.

Still prints 1 :frowning: :frowning: :frowning: :frowning: :frowning: :frowning:

Oops, forgot you have to add .Value for it to print the right value. Anyway print(mult.Value) should print 1.5, if it doesn’t I’ve run out of ideas.

Already did that :frowning: :frowning: :frowning: :frowning: :frowning: :frowning: :frowning:

Just checking: does everything in your script actually work beyond the fact that the script is only ever reading the mult value as 1? If so, where are you modifying mult from? If you are changing it from a local environment (Client view in Test mode or a LocalScript), the server likewise will not receive that updated value and will continue seeing it at its original value. You need to change it from the server.

This is the only plausible explanation I derived from reading the responses. If you see the mult value as 1.5 but printing it shows 1 then you’re modifying the value from a client environment and attempting to read it from a server environment. Client property changes don’t replicate to the server.