Script doesn't change my value

  1. What do you want to achieve? I want the cash value to change

  2. What is the issue? https://gyazo.com/36fbd8c74675ab8a56e65b814779ffb0 The cash value wouldn’t change

  3. What solutions have you tried so far? I tried google searching but nothing work
    Server

game.ReplicatedStorage.Citation.OnServerEvent:Connect(function(plr)
	local plrgui = plr.PlayerGui
	local cash = plrgui:WaitForChild("Info"):WaitForChild("Background").money.Cash
	local fineamount = script.Parent.Parent:WaitForChild("Fine")
	
	cash.Value = cash.Value - fineamount.Value
end)

Client

script.Parent.MouseButton1Click:Connect(function()
	local plrgui = script.Parent.Parent.Parent.Parent
	if plrgui then
		game.ReplicatedStorage:WaitForChild("Citation"):FireServer()
		script.Parent.Parent.Parent:Destroy()
	end
end)```
2 Likes

What is your Output? Please do note that before posting, make sure you did everything you could to fix it.

1 Like

can I see the location of (print screen)

local fineamount = script.Parent.Parent:WaitForChild("Fine")

and the remote event

There is no errors in the output

The issue here is your probably grabbing the value name rather then the value’s value if that makes sense.
Here’s how I would do it.

game.ReplicatedStorage.Citation.OnServerEvent:Connect(function(plr)
	local plrgui = plr:WaitForChild("PlayerGui")
	local cash = plrgui:WaitForChild("Info"):WaitForChild("Background").money.Cash
	local fineamount = script.Parent.Parent:WaitForChild("Fine")
	
	cash.Value = cash.Value - fineamount.Value.Value -- Is fineamount a texlabel, or a value?
	print(cash.Value)
end)
1 Like

Is fineamount a object value? Make sure it is. Also, where is the button located? Can you show me our explorer?

1 Like