i keep getting the error "Unable to assign property Position. Vector3 expected, got CFrame "
(i am bad at scripting)
and even if it got fixed i dont know if the viewmodel would show
heres my code:
local run = game:GetService("RunService") local RS = game:GetService("ReplicatedStorage") local plr = game.Players.LocalPlayer local char = plr.Character local GunModels = RS:WaitForChild("GunModels") local GunModules = RS:WaitForChild("GunModules") local Viewmodel = GunModels["DSA SA58 Viewmodel"] --cloning the viewmodel local clone = Viewmodel:Clone() run.RenderStepped:Connect(function() --changing parent clone.Parent = workspace --putting the viewmodel in front of players camera/head clone.PrimaryPart.Position = char.Head.CFrame * CFrame.new(-5.33, 0, 0) end)
You put in Position
, but you use CFrame
. Hence the error. It's a really easy fix:
local run = game:GetService("RunService") local RS = game:GetService("ReplicatedStorage") local plr = game.Players.LocalPlayer local char = plr.Character local GunModels = RS:WaitForChild("GunModels") local GunModules = RS:WaitForChild("GunModules") local Viewmodel = GunModels["DSA SA58 Viewmodel"] --cloning the viewmodel local clone = Viewmodel:Clone() run.RenderStepped:Connect(function() --changing parent clone.Parent = workspace --putting the viewmodel in front of players camera/head clone.PrimaryPart.CFrame = char.Head.CFrame * CFrame.new(-5.33, 0, 0) end)
The only difference being I replace Position with CFrame on the second last line. Hope this helps!