Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer

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)

This discussion is preserved as it was. New answers, comments, and votes are closed.