Getting userdata value instead of Vector3

I’m currently attempting to make a gun system using the Knit framework, however I’ve ran into this issue where if I supply the LocalPlayer’s HumandRootPart position on the client, it will somehow become a userdata value.

I have a controller and a service for the gun system I am making.

GunService

function GunService.Client:_renderBullet(StartPosition:Vector3, EndPosition:Vector3, Length:number)
	print(type(StartPosition)) -- Prints userdata
	print(type(EndPosition)) -- Prints Vector3
	print(StartPosition:GetChildren()) -- Prints table containing PlayerGui, StarterGear and Backpack
	
	local Bullet = Instance.new("Part")
	Bullet.Parent = game.Workspace.GunService.Tracers
	
	Bullet.CanCollide = false
	Bullet.Anchored = true
	Bullet.BrickColor = BrickColor.new("Pastel yellow")
	Bullet.Size = Vector3.new(0.5, 0.5, 0.5)
	Bullet.CFrame = CFrame.new(StartPosition, EndPosition) * CFrame.new(0, 0, (StartPosition - EndPosition).Magnitude)
end

GunController

local Pos = Player.Character:WaitForChild("HumanoidRootPart").Position
print(type(Pos)) -- Prints Vector3
GunService:_renderBullet(Pos, game.Workspace.AmbientAreas.Sector.Position)

Could anyone possibly point out what I’ve done wrong here?
(Edit: I believe the script thinks I’m just putting Player as the StartPosition argument)

use typeof() instead of

he cant know that if i :heart: that

2 Likes

I will make sure I use that in the future! I’ve asked friend of mine and it turns out that Player is automatically passed as an argument in client functions in Knit, so it should’ve been GunService.Client:_renderBullet(Player:Player, StartPosition:Vector3, EndPosition:Vector3, Length:number) instead. However, thank you for the feedback!

1 Like