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

Attempt to compare two userdata values?

Asked by 6 years ago
Edited 6 years ago

i was making a menu gui for my game and used the camera's lookvector to tell how far i could move it (only left and right at the moment) and when i compare them (shown in script below) i get an error "Players.the8bitdude11.PlayerGui.LocalScript:8: attempt to compare two userdata values"

wait(2) -- because studio
leftMax = Vector3.new(-0.669129193, -0, -0.743146181)
rightMax = Vector3.new(0.669129193, -0, -0.743146181)
workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
workspace.CurrentCamera.CFrame = workspace.Part.CFrame
m = game.Players.LocalPlayer:GetMouse()
while wait() do
    if workspace.CurrentCamera.CFrame.LookVector > leftMax and workspace.CurrentCamera.CFrame.LookVector < rightMax then
        workspace.CurrentCamera.CFrame = CFrame.new(workspace.CurrentCamera.CFrame.Position, m.Hit.Position)
    end
end
0
thank you the8bitdude11 358 — 6y
0
Comparing vectors with an inequality doesn't make sense, but what you can compare is their values on a single axis. LookVector.X > leftMax.X would work. 1waffle1 2908 — 6y

Answer this question