Whenever I playtest the game with 2 players, only their number gets shown, but not anyone else's.
For example: 2 players are in the game, they both have BillboardGuis on top of them. Both of those players can see "Your number is: THIS NUMBER" on their character, but when they look at each other's billboards, it just says "Your number is: LOADING...".
Here's the image link to explain it even further: http://pasteboard.co/nmpCqo9GrRD4.png
Here are the scripts I used:
The 1st script:
local billboard = script.BillboardGui game.Players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(char) local NumText = billboard:Clone() NumText.Parent = char.Head NumText.TextLabel.Text = "Your number is: LOADING..." end) end)
The 2nd script:
local billboardamount = game.Players.LocalPlayer.Character.Head:WaitForChild("BillboardGui").TextLabel local RandNum = Instance.new("NumberValue", game.Players.LocalPlayer) RandNum.Value = math.random while wait(0.1) do billboardamount.Text = "Your number is: ".. end
Can anyone please help me solve this problem?
I think issue is that second script is in localscript so it will only show to player, what you should do is you can make remote event and fire it, then put script in serverscriptstorage and onserverevent change text, like this.
LocalScript
local billboardamount = game.Players.LocalPlayer.Character.Head:WaitForChild("BillboardGui").TextLabel local RandNum = Instance.new("NumberValue", game.Players.LocalPlayer) RandNum.Value = math.random while wait(1) do game.ReplicatedStorage.RemoteEvent:FireServer(RandNum) end
ServerScript
game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(player,randnum) local bgui = player.Character.Head:WaitForChild("BillboardGui") bgui.Text = "Your number is: "..randnum end)
have not tested code, please tell me if there are any errors