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

How Would i Make a Script Work for a Specific Player aka a Gamepass?

Asked by
linx45 -1
6 years ago

So i have been trying to do something like this for a long time but i could not figure it out sadly. This is the script i'm trying to make for when a specific player join's like an Owner or an Admin.

R6 Script V

local rp = game.ReplicatedStorage
local LeftArm = rp:WaitForChild('LeftArm')
local LeftLeg = rp:WaitForChild('LeftLeg')
local RightArm = rp:WaitForChild('RightArm')
local RightLeg = rp:WaitForChild('RightLeg')
local Torso2 = rp:WaitForChild('Torso2')

game.Players.PlayerAdded:connect(function(plr)
    plr.CharacterAdded:connect(function(char)
        char:WaitForChild('Torso')
        char:WaitForChild('Left Leg')
        char:WaitForChild('Left Arm')
        char:WaitForChild('Right Leg')
        char:WaitForChild('Right Arm')

        --// Left Arm
        local ClonedLA = LeftArm:Clone()
        ClonedLA.Parent = char

        ClonedLA.Main.CFrame = char:WaitForChild('Left Arm').CFrame

        local Weld = Instance.new('ManualWeld')
        Weld.Part0 = ClonedLA.Main      
        Weld.Part1 = char:WaitForChild('Left Arm')
        Weld.C0 = ClonedLA.Main.CFrame:inverse() * char:WaitForChild('Left Arm').CFrame
        Weld.Parent = char:WaitForChild('Left Arm')

    end)
end)

So My question is How would i make this work for one player only?

1 answer

Log in to vote
0
Answered by 6 years ago

Check for the players Name.

local rp = game.ReplicatedStorage
local LeftArm = rp:WaitForChild('LeftArm')
local LeftLeg = rp:WaitForChild('LeftLeg')
local RightArm = rp:WaitForChild('RightArm')
local RightLeg = rp:WaitForChild('RightLeg')
local Torso2 = rp:WaitForChild('Torso2')

game.Players.PlayerAdded:connect(function(plr)
    if plr.Name == "PLAYERNAMEHERE" then 
            plr.CharacterAdded:connect(function(char)
            char:WaitForChild('Torso')
            char:WaitForChild('Left Leg')
            char:WaitForChild('Left Arm')
            char:WaitForChild('Right Leg')
            char:WaitForChild('Right Arm')

            --// Left Arm
            local ClonedLA = LeftArm:Clone()
            ClonedLA.Parent = char

            ClonedLA.Main.CFrame = char:WaitForChild('Left Arm').CFrame

            local Weld = Instance.new('ManualWeld')
            Weld.Part0 = ClonedLA.Main      
            Weld.Part1 = char:WaitForChild('Left Arm')
            Weld.C0 = ClonedLA.Main.CFrame:inverse() * char:WaitForChild('Left Arm').CFrame
            Weld.Parent = char:WaitForChild('Left Arm')
        end)
    end
end)
Ad

Answer this question