How do I check if a Vector3 is a Vector3?

Since there is no :IsA() function for a vector 3, how can I check if a Vector 3 is a vector 3?.

A vector3 in my script is sent from the client to the server in a remote event

if (plrMouse.Hit.Position + char:WaitForChild("HumanoidRootPart").Position).Magnitude < 150 then
			
	power_Events:WaitForChild("Transmutation"):FireServer(plrMouse.Hit.Position)
	clientLightingEffects(currentCamera)
			
end

Which sends to the server

power_Events:WaitForChild("Transmutation").OnServerEvent:Connect(function(Player, Info)
	print(Info)
	
	local Character = Player.Character or Player.CharacterAdded:Wait()
	
	if (Info[1] + Character:WaitForChild("HumanoidRootPart").Position).Magnitude < 150 then
		
		powersModule:InitiateTransmutation(Player.Character, Info[1])
		
	end
	
end)

How do I check if the Vector3 is actually a vector 3?

I’m not Really sure why you would check if its a Vector3, but when creating a function, you can assign a Variable as a Vector3

function Something(Example: Vector3)
Part.Position = Example
end

Try typeof(). It should give you a string like “Vector3”:

2 Likes

What would I put to replace the question mark?
if typeof(Info[1]) ~= ? then

“Vector3” , including the quotes, since it returns the string name of the type. typeof() is specific to Roblox. Most of the built int Roblox types are of type ‘userdata’ as far as Lua is concerned, so they give you this function to get the type more specifically.

Ah, it needs to be a string. Thanks for your help!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.