What do you want to achieve? Keep it simple and clear!
I want to make it so when you click a part it gives you a rebirth and resets your time wasted using remote event
What is the issue? Include screenshots / videos if possible!
The issue is that sometimes it only works for 1 player in the server or it doesn’t even work here is the script:
local plr = game.Players.LocalPlayer
game.ReplicatedStorage.RemoteEvents.RemoteEvent.OnClientEvent:Connect(function(Rebirths,Multiplied,IncreaseRebirthCostBy,Part)
local Requirement = plr.ImportantFolder.RebirthCost.Value + Multiplied
if plr.leaderstats.TimeWasted.Value >= Requirement then
plr.leaderstats.Rebirths.Value += Rebirths
plr.ImportantFolder.RebirthCost.Value += IncreaseRebirthCostBy
plr.leaderstats.TimeWasted.Value -= Requirement
end
Part.Text = Requirement
end)
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
It didn’t help.
Oh, I see. But, there’s no need to send a Player when you fire a remote event, it will automatically have the first argument set to the player who fired it, meaning it should look like this:
Weird, since your code should give the error, because the first argument of the .OnClientEvent function is “Rebirths”, which would address the player, meaning this line:
plr.leaderstats.Rebirths.Value += Rebirths -- Tried to do arithmetic/Change a value of something with a Object.