Hi I've tryed to do a gui who it will show the money that we will earn (4 guy in game and it will show it like a global leaderboard but only for the money) but i don't know how to do it I try to do something but It won't work....
here is the script:
local Players = game:GetService("Players") game.Players.ChildAdded:connect(function(player) local indicateur = math.random(1,4) if indicateur == 1 then script.Parent.Indicator1.Text = " "..Players:WaitForChild("leaderstats"):FindFirstChild("Argent").Value end if indicateur == 2 then script.Parent.Indicator2.Text = " "..Players:WaitForChild("leaderstats"):FindFirstChild("Argent").Value end if indicateur == 3 then script.Parent.Indicator3.Text = " "..Players:WaitForChild("leaderstats"):FindFirstChild("Argent").Value end if indicateur == 4 then script.Parent.Indicator4.Text = " "..Players:WaitForChild("leaderstats"):FindFirstChild("Argent").Value end
end)
any Idea to fix it ?
You are currently trying to get leaderstats inside of the Players array, but you're probably trying to get it inside of the player.
You can also use the elseif ... then
statement instead of all the seperate if statements to increase performance, because it will now check them all, but if you use else if it will only check if the previous one was not true.
local Players = game:GetService("Players") Players.ChildAdded:Connect(function(player) local indicateur = math.random(1,4) if indicateur == 1 then script.Parent.Indicator1.Text = " "..player:WaitForChild("leaderstats"):FindFirstChild("Argent").Value elseif indicateur == 2 then script.Parent.Indicator2.Text = " "..player:WaitForChild("leaderstats"):FindFirstChild("Argent").Value elseif indicateur == 3 then script.Parent.Indicator3.Text = " "..player:WaitForChild("leaderstats"):FindFirstChild("Argent").Value elseif indicateur == 4 then script.Parent.Indicator4.Text = " "..player:WaitForChild("leaderstats"):FindFirstChild("Argent").Value end end)
To Nowaha :ok so it's didnt show error but it's stil don't work so, in this script, I want to do a thing, it's if the n°1 is taked so take another one but I don't know how to do please could you write me what did i need to do ? here is the script:
local player = game.Players.LocalPlayer local indicateur = math.random(1,4) if indicateur == 1 then script.Parent.Indicator1.Text = " "..player:WaitForChild("leaderstats"):FindFirstChild("Argent").Value end if indicateur == 2 then script.Parent.Indicator2.Text = " "..player:WaitForChild("leaderstats"):FindFirstChild("Argent").Value end if indicateur == 3 then script.Parent.Indicator3.Text = " "..player:WaitForChild("leaderstats"):FindFirstChild("Argent").Value end if indicateur == 4 then script.Parent.Indicator4.Text = " "..player:WaitForChild("leaderstats"):FindFirstChild("Argent").Value end