Hey guys! I hope you all do well! I’m here today because I got an error getting the player’s Name and the player’s Burst (Image). The first error is that when you’re getting the player’s Name, they aren’t picked in order.
I explain myself:
For the Player1 he sees on the first UI his name, and then the name of the Player2:
1-) Player1 2-) Player2
But for the Player2 he sees on the first UI his name and then the name of the Player1:
1-) Player2 2-) Player1
I’m making a voting system, so the problem is that when someone votes Player1 on his screen, it is gonna be Player7 On someone else’s screen, and so they would be voting someone out that they don’t wan’t to be kicked. I really don’t know how to fix this, I know there’s a lot of good people here that can give me a hand with this. And I’ll appreciate your help if you can at least help me with a little bit.
- I’m on a LocalScript
Here’s the code:
game.ReplicatedStorage:WaitForChild('ActivateRoundMoments').ActivateChoosingSystem.Changed:Connect(function()
local player = game.Players.LocalPlayer
local textLabel = player.PlayerGui:FindFirstChild('NightTest').RuleExplicationText
textLabel.Visible = true
local function typewrite (object, text, length)
for i = 1, #text,1 do
object.Text = string.sub(text,1, i)
wait (length)
end
end
textLabel.Visible = false
if textLabel.Visible == true then
textLabel.Visible = not textLabel.Visible
end
wait(1)
for i, v in pairs(game.Players:GetPlayers()) do
wait(0.1)
local UserId = v.UserId
local ThumbnailType = Enum.ThumbnailType.AvatarBust
local ThumbnailSize = Enum.ThumbnailSize.Size420x420
local PlayersImages = game.Players:GetUserThumbnailAsync(UserId, ThumbnailType, ThumbnailSize)
player.PlayerGui:WaitForChild('PlayerSelectionGui').BackgroundShadowFrame["Player"..i].Image = PlayersImages
player.PlayerGui:WaitForChild('PlayerSelectionGui').BackgroundShadowFrame["Player"..i]:FindFirstChild('PlayerName').Text = v.Name
--Make appear the BackgroundFrame and the TitleFrame--
local BackgroundFrame = player.PlayerGui:WaitForChild('PlayerSelectionGui').BackgroundShadowFrame
local TimerTitleFrame = player.PlayerGui:WaitForChild('ChoosingTimer').TitleFrame
BackgroundFrame.Visible = true
if BackgroundFrame == false then
BackgroundFrame.Visible = not BackgroundFrame.Visible
end
player.PlayerGui.ChoosingTimer:WaitForChild("TitleFrame").Visible = true
if player.PlayerGui.ChoosingTimer:WaitForChild("TitleFrame").Visible == false then
player.PlayerGui.ChoosingTimer:WaitForChild("TitleFrame").Visible = not player.PlayerGui.ChoosingTimer:WaitForChild("TitleFrame").Visible
end
--Tween the BackgroundShadowFrame down(With all the images of the players and their names to vote)--
BackgroundFrame:TweenPosition(UDim2.new(0,0,0,0),"Out","Quad",3,false)
TimerTitleFrame:TweenPosition(UDim2.new(0.049,0,0,0),"Out","Quad",3,false)
--Tween the BackgroundShadowFrame down(With all the images of the players and their names to vote)--
wait(4)
--Play the ChoosingTimerMusic--
game.SoundService:WaitForChild('EnvironmentMusic').ChoosingTimerMusic:Play()
-- Play the ChoosingTimerMusic--
end
--Activate the countdown--
game.ReplicatedStorage:FindFirstChild('RemoteEvents').ChoosingTimer2Gui:FireServer()
--Activate the countdown--
wait(48)
--Localise the Player's Images buttons--
local BackgroundFrame = player.PlayerGui:WaitForChild('PlayerSelectionGui').BackgroundShadowFrame
local TimerTitleFrame = player.PlayerGui:WaitForChild('ChoosingTimer').TitleFrame
BackgroundFrame:TweenPosition(UDim2.new(0,0,2,0),"Out","Quad",3,false)
TimerTitleFrame:TweenPosition(UDim2.new(0.049,0,2,0),"Out","Quad",3,false)
--Localise the Player's Images buttons--
wait(5)
--Make dissapear the BackgroundFrame and the Title Frame--
local BackgroundFrame = player.PlayerGui:WaitForChild('PlayerSelectionGui').BackgroundShadowFrame
BackgroundFrame.Visible = false
if BackgroundFrame.Visible == true then
BackgroundFrame.Visible = not BackgroundFrame.Visible
end
--Make dissapear the BackgroundFrame and the Title Frame--
end)
Here’s how it looks the UI Settings on the PlayerGui:
Also If you can give me an extra help I have an error where the counter goes x2 times faster if there is 2 Players, and if there is 9 Players it goes 9 times faster.
- ServerScript:
game.ReplicatedStorage:WaitForChild('RemoteEvents').UpdateChoosingTimer2Gui.OnServerEvent:Connect(function()
for i = 45, 0, -1 do
wait(1)
game.ReplicatedStorage:WaitForChild('ChoosingTimer2').Value = game.ReplicatedStorage:WaitForChild('ChoosingTimer2').Value - 1
end
end)
I think it’s because of the for I, v in pairs() but it Isn’t in the for I, v in pairs() so I don’t know how to fix this. If you can help me with anything that you see, I’ll be very very grateful to you, have a nice day!