You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I’d like to display players that have been teleported into the queue with a timer that teleports them to the main game on the teleporter itself -
What is the issue? Include screenshots / videos if possible!
When i enter the teleporter it fills both images now i know this is because the for loop but i don’t know of any other method to get a folders children and then fill them and i don’t know how to fill them in order like if player 1 gets displayed for the code to see that and skip over player 1 and display player 2, i guess that’s where my issue lies.
this is what i’d like to achieve :
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
For now none, i have searched but have found nothing.
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Remote2 = ReplicatedStorage:WaitForChild("Remotes"):FindFirstChild("LeaveLobby")
local TouchPart = workspace:FindFirstChild("TwoPlayersTest")
local PlayerImages = TouchPart.PlayerCount.PlayerImages
local Players = game:GetService("Players")
TouchPart.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local PLACEHOLDER_IMAGE = "rbxassetid://0"
local userId = Players:GetPlayerFromCharacter(hit.Parent).UserId
local thumbType = Enum.ThumbnailType.HeadShot
local thumbSize = Enum.ThumbnailSize.Size60x60
local content, isReady = Players:GetUserThumbnailAsync(userId, thumbType, thumbSize)
for _,v in pairs(PlayerImages:GetChildren()) do
v.Image = (isReady and content) or PLACEHOLDER_IMAGE
if v.Image == PLACEHOLDER_IMAGE then
print("Image is a placeholder")
else
print("Image is displaying a player")
end
end
end
end)
Remote2.OnServerEvent:Connect(function()
for _, v in pairs(PlayerImages:GetChildren()) do
v.Image = "rbxassetid://0"
end
end)
local characters = {}
Players.PlayerAdded:Connect(function(player)
player.CharacterRemoving:Connect(function(character)
characters[player] = character
end)
end)
Players.PlayerRemoving:Connect(function(player)
local character = characters[player]
characters[player] = nil
end)
Thanks for the help in advance!