TextLabel not changing on RemoteEvent

So I am making a clicker game and im makinng it so if the player has 10 or more rebirths then it costs more and that works except I want it to change the price text aswell but it doesnt work, I have a script in serverscriptservice when it is triggered by a remot event, see the script below.

local event = game.ReplicatedStorage.remotes.Pushup
local debounce = false


event.OnServerEvent:Connect(function(player)
	local leaderstats = player.leaderstats
	local MogPoints = leaderstats.MogPoints
	local MewStrength = leaderstats.MewStrength
	local Character = player.Character
	if debounce == false then
		debounce = true
		player.leaderstats.MaxHealth.Value += (leaderstats:WaitForChild("MewStrength").Value * 0.05)
		wait(0.15)
		debounce = false
	end
end)

I’m not entirely sure if the entire script is on there since I don’t see anything to do with a textlabel. But to change the textlabel make sure the change is on the client’s side.

1 Like

Yeah im sorry it was the wrong script this is the correct one:

game.ReplicatedStorage.remotes.Upgrade.OnServerEvent:Connect(function(player)
local MewStrength = player.leaderstats.MewStrength
local MogPoints = player.leaderstats.MogPoints
local Button = game.StarterGui.ScreenGui.Shop.ScrollingFrame.ImageLabel.TextButton
if MewStrength.Value < 10 then
if MogPoints.Value >= 1000 then
MogPoints.Value = MogPoints.Value - 1000
MewStrength.Value += 1
Button.parent.TextLabel.Text = “Price: 1000”

	end


elseif MewStrength.Value >= 10 then
	Button.parent.TextLabel.Text = "Price: 10000"
	if MogPoints.Value >= 10000 then
		MogPoints.Value = MogPoints.Value - 10000
		MewStrength.Value += 1	

		

end

end

end)

1 Like

I think you’re trying to change the textlabel’s text from a server script. This doesn’t work because each of the clients basically have their own copies of the textlabel (so does the server), so changing just the server’s text will not affect any of the clients’ copies.

I recommend having a localscript that listens for changes for a player’s change in leaderstats values and have it update the player’s local textlabels instead.

2 Likes

This works thanks!

30 lettesrssss

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.