So basically I made the gui go into a players head to show their level but I tried looking for a solution for this error but can’t all im trying to do is trying to get the level value from the player’s character
Why is that- How is that- W H A T
Ok so in that script, you’re basically parenting the player to:
leaderstats > Leaderstats Folder > ServerScriptService > game
Which doesn’t make any sense? Couldn’t you just use a PlayerAdded
event instead? Try this:
local TextLabel = script.Parent.LevelGui.LevelText
game.Players.PlayerAdded:Connect(function(Player)
local level = Player:WaitForChild("LevelsInfo").Level
level.Changed:Connect(function(NewValue)
TextLabel.Text = NewValue
end)
end)
Well it wouldn’t work since evreytime a player would join the level value would change for that player who joined
If you’re wanting to make it separate for each player, just simply do this:
local Gui = script.LevelGui
game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
local GuiClone = Gui:Clone()
GuiClone.Parent = Character:WaitForChild("Head")
local level = Player:WaitForChild("LevelsInfo").Level
GuiClone.TextLabel.Text = NewValue
level.Changed:Connect(function(NewValue)
GuiClone.TextLabel.Text = NewValue
end
end)
end)
1 Like
Whaaaaaa-???
I don’t even know where to begin. Do something like this:
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
-- clone the level gui and parent it to their head.
-- levelGuiThing.Parent = char.Head
end)
end)
thank you it works
1 Like