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

Why is the TaxValue changing into 0?

Script in ServerScriptService

game.ReplicatedStorage.Main.Events.TaxValueChange.OnServerEvent:connect(function(plr)
	local amountB = plr.PlayerGui.HUD.TaxFrame.Frame.Amount
	
	wait(.5)
	plr:WaitForChild("Tax").Value = amountB.Text
	
end)

LocalScript in a button

script.Parent.MouseButton1Click:connect(function(n)
	local amount = script.Parent.Parent.Amount
	local event = game.ReplicatedStorage.Main.Events.TaxValueChange
	event:FireServer("TaxThoseDuds",0)
end)

Im using a TextBox to change the value of how much taxing is

1 answer

Scripts do not have access to objects in the PlayerGui. Instead of reading the value on the server, it should be passed as an argument by the LocalScript:

event:FireServer(tonumber(player.PlayerGui.HUD.TaxFrame.Frame.Amount))

2 comments

0

Actually they do have access if they take in player as a parameter.

0

Isn't changing the value at all just the same problem is occurring.

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