Int-Values updating on Client side but not on the Server side

You need the parameters, set the job name, and vslue

1 Like

I put this in each button click:

remoteEvent:FireServer("updateStage", 3)

It didn’t work.

1 Like

Are you firing this in a local script?

Yes I am, in each button click in this script:

local UI = script.Parent

local player = game.Players.LocalPlayer

local checkpoints = workspace:WaitForChild("Checkpoints")

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Teleport = ReplicatedStorage:WaitForChild("Teleport")
local remoteEvent = ReplicatedStorage:WaitForChild("remoteEvent")

local Counter = UI:WaitForChild("Counter")
local Level = Counter:WaitForChild("Level")
local Previous = UI:WaitForChild("Previous")
local Next = UI:WaitForChild("Next")
local Previous1 = UI:WaitForChild("Previous1")
local Next1 = UI:WaitForChild("Next1")
local CurrentValue = UI:WaitForChild("Current")

local function previousLevel()
	script.Parent.Handler.Click:Play()
	if CurrentValue.Value ~= 1 then
		CurrentValue.Value = CurrentValue.Value - 1
		player.hidden.SpawnPoint.Value = player.hidden.SpawnPoint.Value - 1
		print("Wait")
		Level.Text = CurrentValue.Value
		-- teleport
		Teleport:FireServer(checkpoints:FindFirstChild(tostring(CurrentValue.Value)))
	end
end

local function previousLevel2()
	script.Parent.Handler.Click:Play()
	if CurrentValue.Value >= 11 then
		CurrentValue.Value = CurrentValue.Value - 10
		player.hidden.SpawnPoint.Value = player.hidden.SpawnPoint.Value - 10
		Level.Text = CurrentValue.Value
		-- teleport
		Teleport:FireServer(checkpoints:FindFirstChild(tostring(CurrentValue.Value)))
	end
end

local function nextLevel()
	script.Parent.Handler.Click:Play()
	if (CurrentValue.Value + 1) <= player.leaderstats.Stage.Value then
		CurrentValue.Value = CurrentValue.Value + 1
		player.hidden.SpawnPoint.Value = player.hidden.SpawnPoint.Value + 1
		Level.Text = CurrentValue.Value
		-- teleport
		Teleport:FireServer(checkpoints:FindFirstChild(tostring(CurrentValue.Value)))
	end
end

local function nextLevel2()
	script.Parent.Handler.Click:Play()
	if (CurrentValue.Value + 10) <= player.leaderstats.Stage.Value then
		CurrentValue.Value = CurrentValue.Value + 10
		player.hidden.SpawnPoint.Value = player.hidden.SpawnPoint.Value + 10
		Level.Text = CurrentValue.Value
		-- teleport
		Teleport:FireServer(checkpoints:FindFirstChild(tostring(CurrentValue.Value)))
	end
end


Previous.MouseButton1Click:Connect(function()
	previousLevel()
	remoteEvent:FireServer("updateStage", 3)
end)

Previous1.MouseButton1Click:Connect(function()
	previousLevel2()
	remoteEvent:FireServer("updateStage", 3)
end)

Next.MouseButton1Click:Connect(function()
	nextLevel()
	remoteEvent:FireServer("updateStage", 3)
end)

Next1.MouseButton1Click:Connect(function()
	nextLevel2()
	remoteEvent:FireServer("updateStage", 3)
end)

CurrentValue.Value = player:WaitForChild("leaderstats").Stage.Value
Level.Text = CurrentValue.Value

player.leaderstats.Stage:GetPropertyChangedSignal("Value"):Connect(function()
	CurrentValue.Value = player.leaderstats.Stage.Value
	Level.Text = CurrentValue.Value
end)

Is the event received, where is it not printing?

The print statments in :FireServer() are printing, so It must be something wrong with the script maybe?

You can use a remote event to trigger the int value change on the server.