Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I am trying to make a tool that spawns a model but it gives me an error. How to fix?

Asked by
MediaHQ 53
4 years ago
Edited 4 years ago

I am trying to make a tool that clones a model but I get an error saying CFrame is not a valid member of Model

My code

local item = script.Parent
local printer = game.Workspace["Test Printer"]

script.Parent.Activated:Connect(function()
    local newprinter = printer:Clone()
    newprinter.Name = "Printer"
    newprinter.Parent = game.Workspace
    newprinter.CFrame = script.Parent.Handle.Position + Vector3.new(10, 0, 0)
    newprinter.Getmony.GetCash.Disabled = false

    script.Parent:Destroy()
end)

Edit: I fixed it by changing Cframe to SetPrimaryPartCframe

2 answers

Log in to vote
0
Answered by 4 years ago

newprinter:MoveTo(script.Parent.Handle.Position + Vector3.new(10, 0, 0))

That Might do it :)

0
I fixed it using setprimarypartcframe MediaHQ 53 — 4y
Ad
Log in to vote
0
Answered by
MediaHQ 53
4 years ago

I fixed it. I was using cframe instead of setprimarypartcframe

local item = script.Parent
local printer = game.Workspace["Test Printer"]

script.Parent.Activated:Connect(function()
    local newprinter = printer:Clone()
    newprinter.Name = "Printer"
    newprinter.Parent = game.Workspace
    newprinter:SetPrimaryPartCFrame(CFrame.new(script.Parent.Handle.Position))
    newprinter.Getmony.GetCash.Disabled = false

    script.Parent:Destroy()
end)

Answer this question