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

how do i get the player i am insted of player1?

Asked by
qwrn12 85
8 years ago
y = 1
x = game.ServerStorage["Baton"]:Clone(); 
game:GetService("UserInputService").InputBegan:connect(function(inputObject, gameProcessedEvent)
    if inputObject.KeyCode == Enum.KeyCode.E then 
        if y == 1 then
        game.Players.Player1.Character.Humanoid:EquipTool(x);
        y = 2
        elseif y == 2 then
        game.Players.Player1.Character.Humanoid:UnequipTools();
        y = 1
        end
    end 
end)
w = game.ServerStorage["BillyClubRiotShield"]:Clone(); 
game:GetService("UserInputService").InputBegan:connect(function(inputObject, gameProcessedEvent)
    if inputObject.KeyCode == Enum.KeyCode.Q then 
        if y == 1 then
        game.Players.Player1.Character.Humanoid:EquipTool(w);
        y = 2
        elseif y == 2 then
        game.Players.Player1.Character.Humanoid:UnequipTools();
        y = 1
        end
    end 
end)

this is my script but it is getting player1 insted of your player

1 answer

Log in to vote
0
Answered by
lukeb50 631 Moderation Voter
8 years ago

localscripts can get the LocalPlayer property from game.Players so for instance:

player=game.Players.LocalPlayer

player is the player that the script is running in

0
thanks qwrn12 85 — 8y
Ad

Answer this question