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

Players.Player1.PlayerGui.Script:14: ')' expected (to close '(' at line 2) near 'local'?

So this error keeps happening in my script and I don't understand why

Players.Player1.PlayerGui.Script:14: ')' expected (to close '(' at line 2) near 'local'

Heres my script

game.Players.PlayerAdded:connect(function(player)
	player.CharacterAdded:connect(function(character)
--Bodycolor and deletion
game.Lighting.Noob:Clone().Parent = character
for i,v in next,character:children'' do
if(v.Name=='BodyColors' or v.ClassName == 'Shirt' or v.ClassName == 'Pants') then
v:Destroy()

end
end
--destroy face
local head = character:FindFirstChild("Head")
if head:FindFirstChild("face") then
	head.face:Destroy()
else
end
-- left arm
local larm = character:findFirstChild("Left Arm")
local lake = larm:Clone()
local model = Instance.new("Model", game.Workspace.Camera)
local humanoid = Instance.new("Humanoid", model)

lake.Parent = model
lake.Name = "Left Arm"
lake.BrickColor = BrickColor.Yellow()
larm.Transparency = 1
	local weld2 = Instance.new("Weld")
	weld2.Parent = lake
	weld2.Part0 = lake
	weld2.Part1 = larm
-- right arm
local rarm = character:findFirstChild("Right Arm")
local rake = rarm:Clone()
local model = Instance.new("Model", game.Workspace.Camera)
local humanoid = Instance.new("Humanoid", model)

rake.Parent = model
rake.Name = "Right Arm"
rake.BrickColor = BrickColor.Yellow()
rarm.Transparency = 1
	local weld2 = Instance.new("Weld")
	weld2.Parent = rake
	weld2.Part0 = rake
	weld2.Part1 = rarm
--left leg
local lleg = character:findFirstChild("Left Leg")
local lefleg = lleg:Clone()
local model = Instance.new("Model", game.Workspace.Camera)
local humanoid = Instance.new("Humanoid", model)

lleg.Parent = model
lleg.Name = "Left Leg"
lleg.BrickColor = BrickColor.Green()
lefleg.Transparency = 1
	local weld2 = Instance.new("Weld")
	weld2.Parent = lefleg
	weld2.Part0 = lefleg
	weld2.Part1 = lleg
-- right leg
local reg = character:findFirstChild("Right Leg")
local rreg = rarm:Clone()
local model = Instance.new("Model", game.Workspace.Camera)
local humanoid = Instance.new("Humanoid", model)

reg.Parent = model
reg.Name = "Right Leg"
reg.BrickColor = BrickColor.Green()
rreg.Transparency = 1
	local weld2 = Instance.new("Weld")
	weld2.Parent = rreg
	weld2.Part0 = rreg
	weld2.Part1 = reg

-- fakehead
local head = character:findFirstChild("Head")
local fake = head:Clone()
fake.Parent = character
fake.Name = "FakeHead"
head.Transparency = 1
       local weld = Instance.new('Weld')
            weld.Parent = fake
            weld.Part0 = fake
            weld.Part1 = head
fake.BrickColor = BrickColor.Yellow()
fake:findFirstChild("face"):Destroy()
-- teleport
wait(2)
game.Players.LocalPlayer.Character:MoveTo(math.random(867.6,899.6) , -23.4, math.random(-306.9, -335))
	end)
end)

1 answer

This removes your errors, but your line 90 will have to be fixed. I can't fix it since i don't know what you're basing it on. I would find a better method of positioning the model rather than between negative numbers like so.

game.Players.PlayerAdded:connect(function(player)
	player.CharacterAdded:connect(function(character)
		--Bodycolor and deletion
		game.Lighting.Noob:Clone().Parent = character
		for i,v in pairs(character:GetChildren()) do
			if(v.Name=='BodyColors' or v.ClassName == 'Shirt' or v.ClassName == 'Pants') then
				v:Destroy()
			end
		end
		--destroy face
		local head = character:FindFirstChild("Head")
		if head:FindFirstChild("face") then
			head.face:Destroy()
			else
				
		end
		-- left arm
		local larm = character:findFirstChild("Left Arm")
		local lake = larm:Clone()
		local model = Instance.new("Model", game.Workspace.Camera)
		local humanoid = Instance.new("Humanoid", model)
		
		lake.Parent = model
		lake.Name = "Left Arm"
		lake.BrickColor = BrickColor.Yellow()
		larm.Transparency = 1
		local weld2 = Instance.new("Weld")
		weld2.Parent = lake
		weld2.Part0 = lake
		weld2.Part1 = larm
		-- right arm
		local rarm = character:findFirstChild("Right Arm")
		local rake = rarm:Clone()
		local model = Instance.new("Model", game.Workspace.Camera)
		local humanoid = Instance.new("Humanoid", model)
		
		rake.Parent = model
		rake.Name = "Right Arm"
		rake.BrickColor = BrickColor.Yellow()
		rarm.Transparency = 1
		local weld2 = Instance.new("Weld")
		weld2.Parent = rake
		weld2.Part0 = rake
		weld2.Part1 = rarm
		--left leg
		local lleg = character:findFirstChild("Left Leg")
		local lefleg = lleg:Clone()
		local model = Instance.new("Model", game.Workspace.Camera)
		local humanoid = Instance.new("Humanoid", model)
		
		lleg.Parent = model
		lleg.Name = "Left Leg"
		lleg.BrickColor = BrickColor.Green()
		lefleg.Transparency = 1
		local weld2 = Instance.new("Weld")
		weld2.Parent = lefleg
		weld2.Part0 = lefleg
		weld2.Part1 = lleg
		-- right leg
		local reg = character:findFirstChild("Right Leg")
		local rreg = rarm:Clone()
		local model = Instance.new("Model", game.Workspace.Camera)
		local humanoid = Instance.new("Humanoid", model)
		
		reg.Parent = model
		reg.Name = "Right Leg"
		reg.BrickColor = BrickColor.Green()
		rreg.Transparency = 1
		local weld2 = Instance.new("Weld")
		weld2.Parent = rreg
		weld2.Part0 = rreg
		weld2.Part1 = reg
		
		-- fakehead
		local head = character:findFirstChild("Head")
		local fake = head:Clone()
		fake.Parent = character
		fake.Name = "FakeHead"
		head.Transparency = 1
		local weld = Instance.new('Weld')
		weld.Parent = fake
		weld.Part0 = fake
		weld.Part1 = head
		--fake.BrickColor = BrickColor.Yellow()
		if fake:FindFirstChild('face') then
			fake['face']:Destroy()
		end
		-- teleport
		wait(2)
		--character:MoveTo(math.random(867,899) , -23.4, math.random(-335, -306)*-1)
	end)
end)


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