Hey, I am following a tutorial and I have tried to fix it for ages! But it doesn’t work
-
What do you want to achieve? For my Shop GUI, I am trying to make it render the part/model.
-
What is the issue? Here is the local script inside the ScreenGui. Thats my createFrame function, and the Camera/Viewport frame part is the one that doesn’t work. I says that position is not a valued member of the part
function createFrame(name,cost,object,parent,itemType)
local frame = itemTemplate:Clone()
frame.Name = name
frame.Title.Text = name
frame.Cost.Text = cost
local VPFObj = object:Clone()
VPFObj.Parent = frame.ViewportFrame
local cam = Instance.new("Camera")
cam.Parent = frame.ViewportFrame
if itemType == "skin" then
-- set camera CFrame to the character's Head
cam.CFrame = CFrame.new(object.Head.Positon + (object.Head.CFrame.lookVector*5) + Vector3.new(0,2,0), object.Head.Positon)
elseif itemType == "gun" then
-- set camera CFrame to the Object (Part)
cam.CFrame = CFrame.new(object.Position + (object.CFrame.LookVector*5) + Vector3.new(0,2,0), object.Position) -- (If it's a model) For the gun, add a Handle Part and do object.Handle.Position
end
frame.ViewPortFrame.CurrentCamera = cam
frame.Parent = parent
return frame
end
- What solutions have you tried so far? I have tried to re write it, I have tried to re organise it. And nothing is working, I haven’t used camera before.
It would be very helpful if you can help me! Thanks