Hello Developers,
so i was making a game called hangman where you have to guess a letter to complete the word. And it seems fine when i was testing on singleplayer test but when i make it to multiplayer test, it doesn’t work.
Here’s the video:
Here’s my script
- (Client)
for _, i in pairs(script.Parent:GetChildren()) do
if i:IsA('TextButton') then
i.MouseButton1Click:Connect(function()
game.ReplicatedStorage.vote:FireServer(i.Name)
end)
end
end
- (Server)
game.ReplicatedStorage.vote.OnServerEvent:Connect(function(player,vote)
for _, plr in pairs(game.Players:GetPlayers()) do
if plr:IsA('Player') then
local PlayerUi = plr:WaitForChild('PlayerGui',50)
local VoteUi = PlayerUi:WaitForChild('Vote',50)
local Voted = VoteUi.LetterVote:FindFirstChild(vote).Frame
for _, remove in pairs(VoteUi.LetterVote:GetChildren()) do
if remove:FindFirstChild('Frame') then
if remove.Frame:FindFirstChild(player.Name) then
remove.Frame:FindFirstChild(player.Name):Destroy()
break
end
end
end
local userId = player.UserId
local thumbType = Enum.ThumbnailType.HeadShot
local thumbSize = Enum.ThumbnailSize.Size420x420
local content, isReady = Players:GetUserThumbnailAsync(userId, thumbType, thumbSize)
local imageLabel = game.ReplicatedStorage.Profile:Clone()
imageLabel.Parent = Voted
imageLabel.Name = player.Name
imageLabel.Image = content
end
end
end)