I keep on getting this error when I run this code, but I have no idea why.
Move.OnServerEvent:Connect(function(person, key, Value, MouseValue)-- Key detection for all players print(Value, CanMove1, grounded) if Value == true and CanMove1 == true and grounded == false then --and MouseValue == false then print(key) if key == W then print(person.name) Name = game.Workspace:WaitForChild(person.name.."Tempman") CanMove2 = true print("Should be true") end if key == A then print(person.name) Name = game.Workspace:WaitForChild(person.name.."Tempman") CanMove3 = true end if key == S then print(person.name) Name = game.Workspace:WaitForChild(person.name.."Tempman") CanMove4 = true end if key == D then print(person.name) Name = game.Workspace:WaitForChild(person.name.."Tempman") CanMove5 = true end if key == Space then print(Space) Name = game.Workspace:WaitForChild(person.name.."Tempman") CanMove6 = true end if key == R then Name = game.Workspace:WaitForChild(person.name.."Tempman") Name:Destroy() function spawnman(person)-- change this when you're gonna do more keys end elseif Value == false then if key == W then CanMove2 = false elseif key == A then CanMove3 = false elseif key == S then CanMove4 = false elseif key == D then CanMove5 = false end if key == "Mouse" then print(MouseValue) Name = game.Workspace:WaitForChild(person.name.."Tempman") --local Mousex = Vector3.new(0,MouseValue.X * -82 + 180, 0) --local Var = Name.Union.Orientation local Var2 = Name.Union.Orientation + one Name.Union.Orientation = Var2 --Var -= Vector3.new(0,MouseValue.X * -82 + 180, 0) --Name.Union.Orientation = Var + Vector3.new(0,MouseValue.X * -82 + 180, 0) Name.Head.Orientation = Vector3.new(MouseValue.Y * -80,0, 0) + Name.Union.Orientation --Name.Focus.Orientation = Name.Head.Orientation Name.Focus.CFrame = Name.Head.CFrame * CFrame.new(4,2.5,6) --local Orient = Name.Focus.Orientation Name.Neck.Orientation = Name.Union.Orientation --Name.Head.Orientation = Orient one = Vector3.new(0,MouseValue.X * -85 + 180, 0) - Name.Union.Orientation end end end
The error is on the last end. Here is the error
ServerScriptService.Spawn/Move:197: Expected 'end' (to close 'function' at line 129), got <eof>; did you forget to close 'then' at line 169?
Move.OnServerEvent:Connect(function(person, key, Value, MouseValue)-- Key detection for all players print(Value, CanMove1, grounded) if Value == true and CanMove1 == true and grounded == false then --and MouseValue == false then print(key) if key == W then print(person.name) Name = game.Workspace:WaitForChild(person.name.."Tempman") CanMove2 = true print("Should be true") end if key == A then print(person.name) Name = game.Workspace:WaitForChild(person.name.."Tempman") CanMove3 = true end if key == S then print(person.name) Name = game.Workspace:WaitForChild(person.name.."Tempman") CanMove4 = true end if key == D then print(person.name) Name = game.Workspace:WaitForChild(person.name.."Tempman") CanMove5 = true end if key == Space then print(Space) Name = game.Workspace:WaitForChild(person.name.."Tempman") CanMove6 = true end if key == R then Name = game.Workspace:WaitForChild(person.name.."Tempman") Name:Destroy() function spawnman(person)-- change this when you're gonna do more keys end end elseif Value == false then if key == W then CanMove2 = false elseif key == A then CanMove3 = false elseif key == S then CanMove4 = false elseif key == D then CanMove5 = false end if key == "Mouse" then print(MouseValue) Name = game.Workspace:WaitForChild(person.name.."Tempman") --local Mousex = Vector3.new(0,MouseValue.X * -82 + 180, 0) --local Var = Name.Union.Orientation local Var2 = Name.Union.Orientation + one Name.Union.Orientation = Var2 --Var -= Vector3.new(0,MouseValue.X * -82 + 180, 0) --Name.Union.Orientation = Var + Vector3.new(0,MouseValue.X * -82 + 180, 0) Name.Head.Orientation = Vector3.new(MouseValue.Y * -80,0, 0) + Name.Union.Orientation --Name.Focus.Orientation = Name.Head.Orientation Name.Focus.CFrame = Name.Head.CFrame * CFrame.new(4,2.5,6) --local Orient = Name.Focus.Orientation Name.Neck.Orientation = Name.Union.Orientation --Name.Head.Orientation = Orient one = Vector3.new(0,MouseValue.X * -85 + 180, 0) - Name.Union.Orientation end end end end)
Here, you forgot "end)" at the end of your code. Hope It worked
Edit: you also forgot to close 'then'