the error starts below here
local function MoveCharacter(lookVector, MoveDis) game.Players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(char) local humanoidRootPart = char.HumanoidRootPart if humanoidRootPart then humanoidRootPart.CFrame = humanoidRootPart.CFrame + (lookVector.CFrame.LookVector * MoveDis) end end) end) end local function ActivateClickDetector (MyClickDetector, MyLookVector, MoveLength) MyClickDetector.MouseClick:Connect(function(mousClick) if mousClick then CameraPrimaryPart.CFrame = CameraPrimaryPart.CFrame +(MyLookVector.CFrame.LookVector * MoveLength) CameraPrimaryPart.Orientation = MyLookVector.Orientation MoveCharacter(MyLookVector, MoveLength)--here it didn't work, idk why, there is no error in the output print("ClickDetector works fine") end end) end ActivateClickDetector(StraightArrowclickDetec, straightArrLookVec, 50) ActivateClickDetector(DiagonalLArrowclickDetec, diagonalLArrLookVec, 50) ActivateClickDetector(DiagonalRArrowclickDetec, diagonalRArrLookVec, 50)
Your script is wrong and you will have to rewrite it. The problem is that you're connecting events in functions instead of connecting functions to events.
Here is a function connected to an event.
function example() print("function ran") end Object.Event:Connect(example)
What you're doing is similar to this:
function example() Object.Event:Connect(function() print("function ran") end) end
Here's how your script should look like:
function moveCharacter(lookVector, moveDis, player) -- extra player variable local character = player.Character if character and character.HumanoidRootPart then -- do stuff end end ClickDetector1.MouseClick:Connect(function(player) -- do camera stuff moveCharacter(lookVector, moveDis, player) end)
On lines 02 to 09, what you're actually doing is waiting for another player to join, then waiting for their character to be loaded in, and then you are making them move. Which is not what you want to do.