Instead of having to do
script.Parent.Parent.Parent.Parent.Character
in a gui to get the player, is there another method which is more efficient?
Instead of having to do
script.Parent.Parent.Parent.Parent.Character
in a gui to get the player, is there another method which is more efficient?
All scripts in the PlayerGui should be local, so therefore you can use LocalPlayer.
local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
plr.CharacterAdded:Wait(): This will make sure the character has loaded.
He mentioned he wants it in a Server Sided Script
I mention he shouldn't use a Regular Script in PlayerGui/StarterGui.
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
This is in a server script so I cannot do game.Players.LocalPlayer