i did not use player gui or any "local stuff" just a folder if even a folder cannot be accessed then idk

now I'm questioning why you could use player.leaderstats(IntValue) in a serverscript and not Folder

so the wrong thing is that it works well in studio so when I'm first place it gives me +70 coins but on server it only gives me +10 even if I'm 1st, 2nd or 3rd

How do I fix this?

game.ReplicatedStorage.PlacePayEvent.OnServerEvent:Connect(function(player)
	local stats = player.leaderstats
	local place = player.Place
	local firstPlace = place.FirstPlace
	local secondplace = place.SecondPlace
	local thirdplace = place.ThirdPlace
	local coins = stats.Coins
	if firstPlace.Value == true then
		coins.Value = coins.Value + 70
	elseif secondplace == true then
		coins.Value = coins.Value + 40
	elseif thirdplace == true then
		coins.Value = coins.Value + 25
	else
		coins.Value = coins.Value + 10 -- 
	end
end)
 ready for the next race!"
end)

LocalScript code:

wait(0.25) -- I never had a problem with this waiting time
game.ReplicatedStorage.IntermissionTimeEvent.OnClientEvent:Connect(function()
	if script.Parent:FindFirstChild("Places") then
		local player = game.Players.LocalPlayer
		game.ReplicatedStorage.PlacePayEvent:FireServer()  -- this is what fires the event server-sided
		player.Place.FirstPlace.Value = false
		player.Place.SecondPlace.Value = false
		player.Place.ThirdPlace.Value = false
		player.PlayerGui.Places:Destroy()
	end
	local player = game.Players.LocalPlayer
	local pbb = player.PowerUpBuy
	local char = player.Character
	local backpack = player.Backpack
	local jpb = pbb.IfJumpPowerUp
	local spb = pbb.IfSpeedPowerUp
	for i,v in pairs(backpack:GetChildren()) do
		v:Destroy()
	end
	for i,v in pairs(char:GetChildren()) do
		if v.ClassName == "Tool" then
			v:Destroy()
		end
	end
	jpb.Value = false
	spb.Value = false
	local rsg = script.Parent.RoundStatusGui
	local rs = rsg.Frame.RoundStatus
	rs.Text = "Intermission! Get ready for the next race!"
end)

5 comments

0

What fires the remote? Post localscript code.

0

We can't figure the issue with just this. Please do post the localscript code.

0

Technical difficulties with the lua box thingy I'll brb

0

Here I have added it to the question description

0

Maybe give the server like 1-2 seconds wait, I always had delays with those FireServer. Also, 'if firstPlace.Value == true then' and 'elseif secondplace == true then' ??