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

How to make Models or Tools Teleport?

Asked by
TrollD3 105
8 years ago

Im trying to make the phantom forces thing where the weapon shows up when you click a textbutton. I have tried everything and nothing works. Here are all the scripts I have made that dont work.

function onClicked()
game.Workspace.IMR = Vector3.new(-159.9, 16.8, -77.8)
end
script.Parent.MouseButton1Down:connect(onClicked)

function onClicked()
game.Workspace.IMR.CFrame = CFrame.new(-159.9, 16.8, -77.8)
end
script.Parent.MouseButton1Down:connect(onClicked)

function onClicked()
game.Workspace.Model = Vector3.new(-159.9, 16.8, -77.8)
end
script.Parent.MouseButton1Down:connect(onClicked)

function onClicked()
game.Workspace.Model.CFrame = CFrame.new(-159.9, 16.8, -77.8)
end
script.Parent.MouseButton1Down:connect(onClicked)

1 answer

Log in to vote
0
Answered by 8 years ago

Models have a property called "PrimaryPart". You choose one part from the model to be the PrimaryPart, and when you move the PrimaryPart, every other part of the model moves in relation to it. You have to move the model using SetPrimaryPartCFrame (or MoveTo, but this doesn't teleport the model).

game.Workspace.Model.PrimaryPart = "insert part here"
function onClicked()
    game.Workspace.Model:SetPrimaryPartCFrame(CFrame.new(-159.9, 16.8, -77.8))
end
script.Parent.MouseButton1Down:connect(onClicked)
Ad

Answer this question