I'm very stuck on this script, a little help would be nice! What I'm trying to do is so if the player "Survived" the waves, then they get +1 win on the leaderboard script and if they didn't nothing happens.
Round Script in SSS
01 | local replicatedstorage = game:GetService( "ReplicatedStorage" ) |
02 | local status = replicatedstorage:WaitForChild( "StatusValue" ) |
03 | local Players = game.Players |
04 | local Health = game.Players.Humanoid.Health |
05 |
06 | while true do |
07 | for i = 15 , 1 ,- 1 do |
08 | status.Value = "Intermission: " ..i |
09 | wait( 1 ) |
10 | end |
11 | status.Value = "Game in progress" |
12 | local map = game.ServerStorage.BaseMap |
13 | map:Clone().Parent = game.Workspace |
14 | target = CFrame.new( 67.98 , - 47.816 , 1156.752 ) |
15 | for i, player in ipairs (game.Players:GetChildren()) do |
Leaderboard Script :
01 | function CreateStats(NewPlayer) |
02 | local MainStats = Instance.new( "IntValue" ) |
03 | MainStats.Name = "leaderstats" |
04 | MainStats.Value = 0 |
05 | local PointsValue = Instance.new( "IntValue" ) |
06 | PointsValue.Name = "Wins" |
07 | PointsValue.Value = 0 |
08 | PointsValue.Parent = MainStats |
09 | MainStats.Parent = NewPlayer |
10 | return MainStats |
11 | end |
12 |
13 | game.Players.ChildAdded:connect(CreateStats) |
This is my solution, I think it works! Hope you like it!
Okay, Here is the Round Script:
(NOTE: I think the Round Script can be a ServerScript (normal script) and be in workspace and work totally fine!)
01 | local replicatedstorage = game:GetService( "ReplicatedStorage" ) |
02 | local status = replicatedstorage:WaitForChild( "StatusValue" ) |
03 | local Players = nil |
04 | local target = nil |
05 |
06 | while true do |
07 | for i = 15 , 1 ,- 1 do |
08 | status.Value = "Intermission: " ..i |
09 | wait( 1 ) |
10 | end |
11 | status.Value = "Game in progress" |
12 |
13 | local map = game.ServerStorage.BaseMap:Clone() |
14 | map.Parent = workspace |
15 |
And here is the LeaderStats script: (NOTE: This script MUST be a LocalScript in StarterPlayer > StarterPlayerScripts in order for it to WORK.)
1 | local LeaderStats = Instance.new( "Model" , game.Players.LocalPlayer) |
2 | LeaderStats.Name = "leaderstats" |
3 |
4 | local Wins = Instance.new( "IntValue" , LeaderStats) |
5 | Wins.Name = "Wins" |
6 | Wins.Value = 0 |
This line is your problem.
1 | if Players.Health 1 + then Wins.Value = + 1 |
Change to this.
1 | if Players.Health > 0 then Wins.Value = Wins.Value + 1 |
You should look at lua tutorials. It will help you way more than asking for the answer. Programming is repetitive problem solving
@imp here's my progress :
01 | -- Vairbles |
02 | local replicatedstorage = game:GetService( "ReplicatedStorage" ) |
03 | local status = replicatedstorage:WaitForChild( "StatusValue" ) |
04 | local player = game.Players.LocalPlayer |
05 | local Health = player.Health:FindFirstChild ? |
06 | local Wins = player.leaderstats.Wins |
07 |
08 | -- Functions |
09 | while true do |
10 | for i = 15 , 1 ,- 1 do |
11 | status.Value = "Intermission: " ..i |
12 | wait( 1 ) |
13 | end |
14 | status.Value = "Game in progress" |
15 | local map = game.ServerStorage.BaseMap |