-
My Goal is completing a waiting game while the players leveling up automatically.
-
The problem is, which is shown in the picture, that both players level going up but they can check on other players level because it stays on 0.*
The next thing I am gonna show you is the script:
local Players = game:GetService("Players")
local rankInformation = require(script.Rankinformation)
local connections = {}
local overHeadTemplate = script.OverheadGui
Players.PlayerAdded:Connect(function(player)
connections[player] = player.CharacterAdded:Connect(function(character)
--while wait(0.01) do --Loop with Duplication Glitch but works!
local newOverhead = overHeadTemplate:Clone()
newOverhead.PlayerName.Text = player.Name
newOverhead.Levels.Text = "Level: " ..player.leaderstats.Level.Value
for _, info in pairs(rankInformation) do
local isPlayerInDivision = player:IsInGroup(info.groupId)
if isPlayerInDivision then
newOverhead.Group.Text = info.name
newOverhead.Group.TextColor3 = info.color
newOverhead.Group.Visible = true
newOverhead.Rank.Text = player:GetRoleInGroup(info.groupId)
newOverhead.Rank.Visible = true
newOverhead.Rank.TextColor3 = Color3.fromRGB(136, 225, 20)
end
end
character:WaitForChild("Humanoid").DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None
newOverhead.Parent = character:WaitForChild("HumanoidRootPart")
--character.HumanoidRootPart.OverheadGui:Destroy() --Doesn't do anything Destroy's maybe everything but doesn't come back.
--end --Loop with Duplication Glitch but works!
end)
end)
Players.PlayerRemoving:Connect(function(player)
if connections[player] then
connections[player]:Disconnect()
connections[player] = nil
end
end)
The script needs one line or maybe more to get the level shown to other players while playing!
3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
- In the script you can see I did add a wait() in one of the columns which I thought it’s a great idea but
the OverheadText did not got Destroyed nor it helped. (So don’t use my idea!)
*Now here comes the interesting part:
After I played with the two players, I killed one (reset button) and then the level got renamed as the one on the leaderstats or the Value. (Where I usually count the level up).
The other player could see the new level but didn’t count further on.
The reset method is not an valid answer what I am looking for.
I want someone post a part script and tell me in which column I should put it in!
Thanks for reading