generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: I need assistance with a script:

Previous Thread :: Next Thread 
Chronomaton is online. Chronomaton
Joined: 02 Feb 2012
Total Posts: 3461
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
Chronomaton is online. Chronomaton
Joined: 02 Feb 2012
Total Posts: 3461
16 May 2017 01:05 PM
And I do know how to do touch events.
Report Abuse
Chronomaton is online. Chronomaton
Joined: 02 Feb 2012
Total Posts: 3461
16 May 2017 01:08 PM
Bump.
Report Abuse
DevJoas is not online. 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 is not online. 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 is not online. DevJoas
Joined: 17 Dec 2014
Total Posts: 627
16 May 2017 01:24 PM
true
Report Abuse
Chronomaton is online. Chronomaton
Joined: 02 Feb 2012
Total Posts: 3461
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
Mister_Manakin is not online. Mister_Manakin
Joined: 16 Sep 2009
Total Posts: 1935
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
Chronomaton is online. Chronomaton
Joined: 02 Feb 2012
Total Posts: 3461
16 May 2017 02:06 PM
Still not working.
Report Abuse
Gomlsauresrex is not online. Gomlsauresrex
Joined: 25 Mar 2016
Total Posts: 3588
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
Gomlsauresrex is not online. Gomlsauresrex
Joined: 25 Mar 2016
Total Posts: 3588
16 May 2017 02:14 PM
p.CFrame=p.CFrame:lerp(destination, i/10)*
Report Abuse
Super73706 is not online. Super73706
Joined: 31 Mar 2017
Total Posts: 112
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 is not online. DevJoas
Joined: 17 Dec 2014
Total Posts: 627
16 May 2017 03:12 PM
^ no
Report Abuse
Super73706 is not online. Super73706
Joined: 31 Mar 2017
Total Posts: 112
16 May 2017 03:14 PM
it worked for me I just tested it


Report Abuse
DevJoas is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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
Super73706 is not online. Super73706
Joined: 31 Mar 2017
Total Posts: 112
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 is not online. DevJoas
Joined: 17 Dec 2014
Total Posts: 627
16 May 2017 03:26 PM
Yes @above, use CFrame.lookVector
Report Abuse
Chronomaton is online. Chronomaton
Joined: 02 Feb 2012
Total Posts: 3461
16 May 2017 03:27 PM
I like how this thread is just turning into a general help thread LOL.
Report Abuse
DevJoas is not online. 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
Super73706 is not online. Super73706
Joined: 31 Mar 2017
Total Posts: 112
16 May 2017 04:54 PM
What Program Did You Use To Make The Door Mesh?


Report Abuse
Super73706 is not online. Super73706
Joined: 31 Mar 2017
Total Posts: 112
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image