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

How do i make this script add it to the other value?(SOLVED)

script.PPS.OnServerEvent:connect(function(plr)
    plr.leaderstats.Parts.Value = plr.leaderstats.Parts.Value + plr.leaderstats.PPS.Value
end)
while true do
	workspace.Events.PPS:FireServer()
	wait(1)
end

When i go to the shop in my game, and buy a Clicker it gives me the 1 PPS, but doesn't give me it added to my Parts every second. How can i make this work?

1 answer

✓ Accepted answer

This is because you are attempting to use :FireServer() on the server. Sorry to say, but you don't need a remote event for something like this.

I assume you want to make every player in the server receive a "Part", but you don't really know how to grab the player.

You can use loops to achieve this. Following example is in a server script.

local Players = game:GetService("Players")

while true do
	for i, plr in pairs(Players:GetPlayers()) do -- go through every player in the game, and give them Parts based on their Parts Per Second
		plr.leaderstats.Parts.Value = plr.leaderstats.Parts.Value + plr.leaderstats.PPS.Value
	end
	wait(1)
end

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