Im trying to make a script that teleports a model to the mouses CFrame position! Please Help :D
Output: 18:06:23.346 - CoordinateFrame is not a valid member
target = game.Players.LocalPlayer:GetMouse().Hit
game.Workspace.Model:MoveTo(target)
Im trying to make a script that teleports a model to the mouses CFrame position! Please Help :D
Output: 18:06:23.346 - CoordinateFrame is not a valid member
target = game.Players.LocalPlayer:GetMouse().Hit
game.Workspace.Model:MoveTo(target)
The method MoveTo takes a Vector3, not a CoordinateFrame.
Mouse.Hit returns a CoordinateFrame.
http://wiki.roblox.com/index.php?title=API:Class/Mouse/Hit http://wiki.roblox.com/index.php?title=API:Class/Model/MoveTo
target = game.Players.LocalPlayer:GetMouse().Hit
game.Workspace.Model:MoveTo(Vector3.new(target))
Using the Vector3 constructor on the CFrame is a simple and quick way to convert.
To move models with CFrame, you should use :SetPrimaryPartCFrame(**arg1**CFrame) instead of :MoveTo(**arg1** Vector3).
To use :SetPrimaryPartCFrame() , you should first set PrimaryPart by Model's Properties Tab.
After setting that, you will be able to use it.
local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
local model = workspace:WaitForChild("ModelName")
model:SetPrimaryPartCFrame(mouse.Hit)
This discussion is preserved as it was. New answers, comments, and votes are closed.