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)