|
| 16 May 2017 01:05 PM |
I'm terrible at Vector3, so let's just get that out there.
www.roblox.com/library/810835533/Sci-Fi-Door
I need the diamond plate material part in this model to slide to the right upon a player walking up to it, and then I need it to slide back.
How would I do this? |
|
|
| Report Abuse |
|
|
|
| 16 May 2017 01:05 PM |
| And I do know how to do touch events. |
|
|
| Report Abuse |
|
|
| |
|
DevJoas
|
  |
| Joined: 17 Dec 2014 |
| Total Posts: 627 |
|
|
| 16 May 2017 01:15 PM |
Just change the position?
Read these articles:
wiki.roblox.com/index.php?title=API:Vector3
wiki.roblox.com/index.php?title=API:Class/BasePart/Position
something like : part.Position = part.Position + Vector3.new(0.1,0,0)
In a for loop |
|
|
| Report Abuse |
|
|
DataStore
|
  |
| Joined: 07 Feb 2012 |
| Total Posts: 8540 |
|
|
| 16 May 2017 01:24 PM |
DevJoas' insight fails to take into consideration the framing.
If you attempt to modify the 'Position' property, you'll only accomplish removing the door from its frame (and the door going to wherever there's space).
To do what you want, you'll need to edit the door part's CFrame - There's various articles on the Wiki dealing with this. As you also want the door to open, when users approach, you should look into magnitude - Or alternatively, use invisible parts. It lacks finesse, but gets the job done. |
|
|
| Report Abuse |
|
|
DevJoas
|
  |
| Joined: 17 Dec 2014 |
| Total Posts: 627 |
|
| |
|
|
| 16 May 2017 01:30 PM |
@DataStore
I just read up on CFrame and Vector3
I get now that Vector3 finds space if it collides with a block, and I know how to edit CFrame for movement, what I don't know how to do is how would I ease the part into that position? Adding values to CFrame continuously? If so, how would I go about doing that?
My apologies if this is frustrating, I'm really new to scripting. |
|
|
| Report Abuse |
|
|
|
| 16 May 2017 01:36 PM |
local origin = part.CFrame local destination = CFrame.new(blah,blah,blah)
for i = 0, 1, 0.01 do part.CFrame = origin:lerp(destination, i) wait() end
|
|
|
| Report Abuse |
|
|
| |
|
|
| 16 May 2017 02:13 PM |
function getslate() for _,v in pairs(script.Parent:GetChildren()) do if v:IsA("Part") and v.Material==Enum.Material.DiamondPlate then return v end end end
local p=getslate() local cf=CFrame.new local destination=cf(coords)
for i=1,10 do p.CFrame=p.CFrame:lerp(destination, 1/10) wait(0.01) end
|
|
|
| Report Abuse |
|
|
|
| 16 May 2017 02:14 PM |
| p.CFrame=p.CFrame:lerp(destination, i/10)* |
|
|
| Report Abuse |
|
|
|
| 16 May 2017 03:11 PM |
Brick = script.parent
function Ontouch() Brick.CFrame = Brick.Cframe + Vector3.new(0,0,0.1) wait(0.1) Brick.CFrame = Brick.Cframe + Vector3.new(0,0,0.1) wait(0.1) Brick.CFrame = Brick.Cframe + Vector3.new(0,0,0.1) wait(0.1) Brick.CFrame = Brick.Cframe + Vector3.new(0,0,0.1) wait(0.1) Brick.CFrame = Brick.Cframe + Vector3.new(0,0,0.1) wait(0.1) Brick.CFrame = Brick.Cframe + Vector3.new(0,0,0.1) wait(0.1) Brick.CFrame = Brick.Cframe + Vector3.new(0,0,0.1) wait(0.1) Brick.CFrame = Brick.Cframe + Vector3.new(0,0,0.1) wait(0.1) Brick.CFrame = Brick.Cframe + Vector3.new(0,0,0.1) wait(0.1) Brick.CFrame = Brick.Cframe + Vector3.new(0,0,0.1) end
function Offtouch() Brick.CFrame = Brick.Cframe + Vector3.new(0,0,-0.1) wait(0.1) Brick.CFrame = Brick.Cframe + Vector3.new(0,0,-0.1) wait(0.1) Brick.CFrame = Brick.Cframe + Vector3.new(0,0,-0.1) wait(0.1) Brick.CFrame = Brick.Cframe + Vector3.new(0,0,-0.1) wait(0.1) Brick.CFrame = Brick.Cframe + Vector3.new(0,0,-0.1) wait(0.1) Brick.CFrame = Brick.Cframe + Vector3.new(0,0,-0.1) wait(0.1) Brick.CFrame = Brick.Cframe + Vector3.new(0,0,-0.1) wait(0.1) Brick.CFrame = Brick.Cframe + Vector3.new(0,0,-0.1) wait(0.1) Brick.CFrame = Brick.Cframe + Vector3.new(0,0,-0.1) wait(0.1) end
Brick.Touched:connect(Ontouch) Brick.TouchEnded:connect(Offtouch)
|
|
|
| Report Abuse |
|
|
DevJoas
|
  |
| Joined: 17 Dec 2014 |
| Total Posts: 627 |
|
| |
|
|
| 16 May 2017 03:14 PM |
it worked for me I just tested it
|
|
|
| Report Abuse |
|
|
DevJoas
|
  |
| Joined: 17 Dec 2014 |
| Total Posts: 627 |
|
|
| 16 May 2017 03:19 PM |
| It works, but it's bad practice and shouldn't be done that way |
|
|
| Report Abuse |
|
|
RuizuKun
|
  |
| Joined: 20 Jan 2016 |
| Total Posts: 1133 |
|
|
| 16 May 2017 03:20 PM |
Okay lets do touch first since you mentioned it
Part.Touched:connect(function(TouchedPart)
end)
Part.TouchEnded:connect(function(TouchedPart)
end)
------------------------
Vector3 is a value of 3 numbers X Y Z , its the Cords from the Center of the Game Place 0,0,0 Which Increase or Decrases
---You know what? I'm bad that Explaining Sorry Dude--
Let Senpai DevJoas help ya
RuizuKun |
|
|
| Report Abuse |
|
|
DevJoas
|
  |
| Joined: 17 Dec 2014 |
| Total Posts: 627 |
|
|
| 16 May 2017 03:21 PM |
| use .Touched like ######## said and combine DataStore's and mine original answers and you have your code |
|
|
| Report Abuse |
|
|
DevJoas
|
  |
| Joined: 17 Dec 2014 |
| Total Posts: 627 |
|
|
| 16 May 2017 03:21 PM |
| Your name is very offensive according to ROBLOX @above |
|
|
| Report Abuse |
|
|
RuizuKun
|
  |
| Joined: 20 Jan 2016 |
| Total Posts: 1133 |
|
|
| 16 May 2017 03:24 PM |
I know Right , I was too much Swag Roblox can't handle it LOL, you are an awesome teacher Senpai DevJoas , Do you make any games ???
RuizuKun |
|
|
| Report Abuse |
|
|
|
| 16 May 2017 03:26 PM |
Is there a way to make it so no matter what rotation you place the door at it slides to the side?
|
|
|
| Report Abuse |
|
|
DevJoas
|
  |
| Joined: 17 Dec 2014 |
| Total Posts: 627 |
|
|
| 16 May 2017 03:26 PM |
| Yes @above, use CFrame.lookVector |
|
|
| Report Abuse |
|
|
|
| 16 May 2017 03:27 PM |
| I like how this thread is just turning into a general help thread LOL. |
|
|
| Report Abuse |
|
|
DevJoas
|
  |
| Joined: 17 Dec 2014 |
| Total Posts: 627 |
|
|
| 16 May 2017 03:28 PM |
| ###### I usually start projects then finish them 90% and then start a new project But this is not the place to talk about things like that, we're off topic |
|
|
| Report Abuse |
|
|
|
| 16 May 2017 04:54 PM |
What Program Did You Use To Make The Door Mesh?
|
|
|
| Report Abuse |
|
|
|
| 16 May 2017 05:03 PM |
oh yeah and here is a good script:
Brick = script.Parent
function Ontouch() for i=1, 6 do wait(0.1) Brick.CFrame = Brick.CFrame + Vector3.new(0,0.1,0) wait(0.1) end end
Brick.Touched:connect(Ontouch)
|
|
|
| Report Abuse |
|
|