I need to know this cuz im putting the script inside a part
✓ ANSWER ACCEPTED
How do I access the Player Component and Player Character without the use of local script?
2 answers
✓ Accepted answer
What you could do is make a 'playerAdded event' like so:
game.Players.PlayerAdded:connect(function(player)
--stuff heer
end)
but say you want to play it on the character, not the player. You'd simply do a character added one right after it.
game.Players.PlayerAdded:connect(function(player)
--player stuff heer
player.CharacterAdded:connect(function(character)
--character stuff here
end)
end)
-Player: http://wiki.roblox.com/index.php?title=PlayerAdded
-Character: http://wiki.roblox.com/index.php?title=CharacterAdded
-- Put this in the StarterGui or StarterPack
-- It will Lead to PlayerGui or Backpack which that parent will be the Player itself
local Player = script.Parent.Parent
local Character = Player.Character or game["Workspace"]:WaitForChild(Player.Name)
This discussion is preserved as it was. New answers, comments, and votes are closed.
