What do you want to achieve? Keep it simple and clear!
I want to make a ‘number of waves survived’ global leaderboard.
What is the issue? Include screenshots / videos if possible!
I cant seem to get the value in my ‘waves’ int value (in workspace) into the value of waves in my leaderstats.
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
ive tried scripting things myself - looked on dev forum - google and youtube but cant find anything to guide me.
I tried to make a remote event to communicate with the server to transfer the int value from workspace into the int value in my leaderstats but it isnt working and added the following script in server script service. Im obviously doing something sooo wrong :'D
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.
Ops sorry I didn’t mean to respond under your comment I was basically saying the same thing but I think there trying to update the value in a server script I’m just wondering if they are trying to fire a remote event for a server script to a server script
Like @anon36900032 asked, are you changing the wave count from a local script?
But aside from that I’d tackle it like this:
(In a server script)
game.Workspace.Spawns.Waves.Changed:Connect(function(val)
for _,plr in pairs(game.Players:GetChildren()) do
plr.leaderstats.MaxWaves.Value = val
end
end)
I have a spawn (server)script in my spawn folder which is in work space. In this script it records the spawn number into a wave intvalue which is in the same spawn folder.
I’m wanting to transfer this int value into my leaderstats.
Unless there is a more simple way to do this?
You don’t have to transfer it to your leaderstats script you change it in you workspace script if it’s a server script. Just do the same line of code in you leaderstats script just take out the remote event parts and you should be good
Did you end up trying this script? And it can obviously be changed to work with a single player instead of looping through all the players. Just wondering if this works for what you’re trying to accomplish.
Hi PieRat, I tried this today and it didnt work. I also tried the following in my leaderstats script and it didnt work. I just dont understand why it isnt picking up the int value in my spawns folder in workspace.
This is what i tried in my leaderstats script:
|—|—|
||local MaxWaves = Instance.new(IntValue)|
||MaxWaves.Name = MaxWaves|
||MaxWaves.Parent = leaderstats|
local Waves = game.Workspace.Spawns.Waves
Waves.Changed:Connect(function(Changed)
if Waves.Value > MaxWaves.Value then
MaxWaves.Value = Waves.Value
end
end)
Thankyou for all of your help. I actually got the above working in my leaderstats- realised i left an extra Waves int value in the Spawns folder when i was messing about with it last week. But the script i put in my leaderstats works. Thankyou for all of your suggestions. Now i need to makesure it all saves and i can bring the waves into my lobby.