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

can this error be explained?

Asked by 9 years ago

So, i have been working on a falling script that when falling between two distances, and planning on having it kill the person on impact if they don't activate the parachute between the distances. The error is "attempt to compare two userdata values"

plr = game.Players.LocalPlayer
local warn = false
plr.Character.Torso.Changed:connect(function()
print("Torso Prop has changed!")
print(plr.Character.Torso.Position)
6.) if plr.Character.Torso.Position > Vector3.FromAxis(Enum.Axis.Y, 134) and plr.Character.Torso.Position < Vector3.FromAxis(Enum.Axis.Y, 1180)and plr.Backpack.Parachute ~= nil then
print("Falling")
warn = true
while warn == true do
plr.PlayerGui.Fallwarn.warning.Visible = true
wait(2)
plr.PlayerGui.Fallwarn.warning.Visible = false
wait(2)
end
else
warn = false
plr.PlayerGui.Fallwarn.warning.Visible = false
end
end)

any help with this? (The error is at line 6.)

1 answer

Log in to vote
0
Answered by 9 years ago

You can't compare a whole vector with an axis. The vector I am talking about is when comparing the position.

As an vector is built up by using three different axis'es, X axis, Y axis and Z axis.

This makes the vector3 act like a table containing 3 arrays.

Which makes it impossible to compare this 'table' with another array.

Example:

table = {
one    = "1",
two    = "2",
three = "3,"
}

if table > 2 then
-execute stuff
end

That would also give us the error: 'Attempt to compare two userdata values'

0
okay, that explains it. Now, can you tell me a way to fix this? rollercoaster57 65 — 9y
Ad

Answer this question