|
| 15 Jun 2014 05:26 AM |
as for the tittel said
also like :
model = script.Parent modelposition = ???? idk
bla bla bla
|
|
|
| Report Abuse |
|
|
RoflBread
|
  |
| Joined: 18 Jun 2009 |
| Total Posts: 3803 |
|
|
| 15 Jun 2014 05:28 AM |
model:MoveTo()
Either that or you make a loop that moves every part of the model to a new position while keeping their relative positions the same. |
|
|
| Report Abuse |
|
|
| |
|
|
| 15 Jun 2014 05:32 AM |
| also how can i move him from his original position to his original position but littel higher please give an example too |
|
|
| Report Abuse |
|
|
| |
|
RoflBread
|
  |
| Joined: 18 Jun 2009 |
| Total Posts: 3803 |
|
|
| 15 Jun 2014 05:50 AM |
I'm writing this off the top of my head:
function CFrameModel(model,position,angle) if not model:IsA("Model") then return end
local parts = {}
local function scan(part) local children = part:GetChildren()
if part:IsA("BasePart") then table.insert(parts,part) end
if #children > 0 then for _, v in pairs(children) do scan(v) end end end
scan(model)
local offset local angles local new_angles local centre = model:GetModelCFrame().p
for i,v in pairs(parts) do
offset = v.Position - centre angles = v.CFrame - v.Position new_angles = angles * angle v.CFrame = CFrame.new(position+offset) * new_angles end
end
Example usage:
CFrameModel(Workspace.Model,Vector3.new(0,10,0),CFrame.Angles(0,math.pi/2,0))
The advantage over the MoveTo method obviously being you can rotate using this and it won't move the parts if they intersect(if they're anchored) |
|
|
| Report Abuse |
|
|
RoflBread
|
  |
| Joined: 18 Jun 2009 |
| Total Posts: 3803 |
|
|
| 15 Jun 2014 06:07 AM |
For the distance thingy
player = game.Players.LocalPlayer character = player.Character
--When E is pressed
if mouse.Target == nil then return end
local distance = (character:GetModelCFRame().p - mouse.Target.Position).magnitude
if distance > 20 then return end |
|
|
| Report Abuse |
|
|
|
| 15 Jun 2014 06:12 AM |
Script :
plr = game.Players.LocalPlayer epic = plr:GetMouse()
epic.KeyDown:connect(function(key) ypcall(function() if key:lower() == "e" then game.Workspace.Cell.Script.Disabled = false -- this will make the cell get up then get down
end end) end)
while wait() do ypcall(function() end) end |
|
|
| Report Abuse |
|
|
|
| 15 Jun 2014 06:15 AM |
also here is the Disabled script :
game.Workspace.Cell:TranslateBy(Vector3.new(0 , 1 , 0)) wait(.4) game.Workspace.Cell:TranslateBy(Vector3.new(0 , 1 , 0)) wait(.4) game.Workspace.Cell:TranslateBy(Vector3.new(0 , 1 , 0)) wait(.4) game.Workspace.Cell:TranslateBy(Vector3.new(0 , 1 , 0)) wait(.4) game.Workspace.Cell:TranslateBy(Vector3.new(0 , 1 , 0)) wait(.4) game.Workspace.Cell:TranslateBy(Vector3.new(0 , 1 , 0)) wait(.4) game.Workspace.Cell:TranslateBy(Vector3.new(0 , 1 , 0)) wait(.4) game.Workspace.Cell:TranslateBy(Vector3.new(0 , 1 , 0)) wait(.4) game.Workspace.Cell:TranslateBy(Vector3.new(0 , 1 , 0)) wait(7) game.Workspace.Cell:TranslateBy(Vector3.new(0 , -1 , 0)) wait(.4) game.Workspace.Cell:TranslateBy(Vector3.new(0 , -1 , 0)) wait(.4) game.Workspace.Cell:TranslateBy(Vector3.new(0 , -1 , 0)) wait(.4) game.Workspace.Cell:TranslateBy(Vector3.new(0 , -1 , 0)) wait(.4) game.Workspace.Cell:TranslateBy(Vector3.new(0 , -1 , 0)) wait(.4) game.Workspace.Cell:TranslateBy(Vector3.new(0 , -1 , 0)) wait(.4) game.Workspace.Cell:TranslateBy(Vector3.new(0 , -1 , 0)) wait(.4) game.Workspace.Cell:TranslateBy(Vector3.new(0 , -1 , 0)) wait(.4) game.Workspace.Cell:TranslateBy(Vector3.new(0 , -1 , 0))
script.Disabled = true
|
|
|
| Report Abuse |
|
|
RoflBread
|
  |
| Joined: 18 Jun 2009 |
| Total Posts: 3803 |
|
|
| 15 Jun 2014 06:20 AM |
try that
plr = game.Players.LocalPlayer epic = plr:GetMouse() cell = game.Workspace.Cell
epic.KeyDown:connect(function(key) ypcall(function() dist = (plr.Torso.Position - mouse.Target.Position).Magnitude if key:lower() == "e" and epic.Target:IsDescendantOf(cell) and dist < 20 then cell.Script.Disabled = false -- this will make the cell get up then get down end end) end) |
|
|
| Report Abuse |
|
|