Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I access the Player Component and Player Character without the use of local script?

Asked by 8 years ago

http://prntscr.com/8ksltj

I need to know this cuz im putting the script inside a part

2 answers

Log in to vote
0
Answered by
NotSoNorm 777 Moderation Voter
8 years ago

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

Ad
Log in to vote
0
Answered by 8 years ago

-- 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)

Answer this question