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 » Scripting Helpers
Home Search
 

Re: Cover deploy script, need help

Previous Thread :: Next Thread 
vortexyamum is not online. vortexyamum
Joined: 31 Aug 2011
Total Posts: 1979
31 May 2014 10:13 PM
I have the main script and it deploys perfectly fine but I have no clue on how I could make it rotate based on the direction the player was facing when deployed. Because right now it only faces one direction and that won't really be helpful if your trying to fight someone in the direction it doesn't face. This isn't a tool but a hopper bin. If you want to see the actual script then here:

function onButton1Down(mouse)
local b = Instance.new("Part")
b.BrickColor = BrickColor.new(217)
b.Position = mouse.Hit.p
b.Size = Vector3.new(1, 10, 5)
b.Shape = 1
b.Parent = game.Workspace
b.Anchored = true
game:GetService("Debris"):AddItem(b, 500)
wait(.1)
script.Parent:Destroy()
end

function onSelected(mouse)
mouse.Button1Down:connect(function() onButton1Down(mouse) end)

end

script.Parent.Selected:connect(onSelected)


Tl:DR
I need help in making the above script place the object and make it's rotation based on the players.
Report Abuse
vortexyamum is not online. vortexyamum
Joined: 31 Aug 2011
Total Posts: 1979
31 May 2014 10:17 PM
I'm gonna start browsing the roblox wiki to see if it has any useful info ._.
Report Abuse
vortexyamum is not online. vortexyamum
Joined: 31 Aug 2011
Total Posts: 1979
31 May 2014 10:32 PM
Only pages I saw about rotation was vector3 and CFrame pages. Two pages that make no sense to me :(
Report Abuse
cooldude999921 is not online. cooldude999921
Joined: 13 Aug 2011
Total Posts: 3702
31 May 2014 10:40 PM
http://wiki.roblox.com/index.php?title=CFrame#Rotating_Bricks
Report Abuse
golfercab is not online. golfercab
Joined: 26 Sep 2011
Total Posts: 714
31 May 2014 10:40 PM
rotating gets really technical.... there is a set of values that involve a look vector or a set of values that involve the direction it is being looked at from
Report Abuse
golfercab is not online. golfercab
Joined: 26 Sep 2011
Total Posts: 714
31 May 2014 10:42 PM
"CFrame.new(Vector3 position, Vector3 point)"
"Creates CFrame from position, and looking at point."

from the link posted i think you would need to use something like this?
Report Abuse
golfercab is not online. golfercab
Joined: 26 Sep 2011
Total Posts: 714
31 May 2014 10:43 PM
i guest by vector3 it is saying
CFrame.new(0,0,0,0,0,0)? im new to this type of stuff too
Report Abuse
vortexyamum is not online. vortexyamum
Joined: 31 Aug 2011
Total Posts: 1979
31 May 2014 10:48 PM
Basically what I want it to do is rotate towards the players torso. So that way it doesn't end up being sideways when placed. I'l experiment with the rotation until I can get it to work I guess.
Report Abuse
vortexyamum is not online. vortexyamum
Joined: 31 Aug 2011
Total Posts: 1979
31 May 2014 10:59 PM
I don't know what I'm doing. Derp.
Report Abuse
Quasar99 is not online. Quasar99
Joined: 21 Nov 2009
Total Posts: 9328
31 May 2014 11:04 PM
just get the player's torso rotation and change the brick's rotation to be the same

i dont know lua syntax but this should be easy enough.
Report Abuse
golfercab is not online. golfercab
Joined: 26 Sep 2011
Total Posts: 714
31 May 2014 11:07 PM

https://www.youtube.com/watch?v=9UwRdRkt1k4

at the 14 minute area you can see stml uses look vector
Report Abuse
vortexyamum is not online. vortexyamum
Joined: 31 Aug 2011
Total Posts: 1979
31 May 2014 11:08 PM
What do you think my first thought was? It is definitely possible but not something I would consider trying to find out because the roblox wiki has minimal information on rotation through CFrame and Vector3. Plus, don't say weather of not something is easy in scripting if you don't even know the syntax of lua.
Report Abuse
golfercab is not online. golfercab
Joined: 26 Sep 2011
Total Posts: 714
31 May 2014 11:08 PM
whoops, i mean the 15 minute 30 second mark, i dont think the filter will elt me say this differently =x
Report Abuse
vortexyamum is not online. vortexyamum
Joined: 31 Aug 2011
Total Posts: 1979
31 May 2014 11:13 PM
Derp.
Report Abuse
Paramedic4 is not online. Paramedic4
Joined: 23 Jan 2011
Total Posts: 5934
31 May 2014 11:17 PM
Ohhh! Use lookVector for this, it returns the facing direction of a part. It is also a property of CFrame
Report Abuse
vortexyamum is not online. vortexyamum
Joined: 31 Aug 2011
Total Posts: 1979
31 May 2014 11:25 PM
I have absolutely no clue on how to use look vector but this is what I'v done to the script. Sadly it no works :(. Now nothing happens on click because I used the look vector wrong. Derp.

local torso = script.Parent.Parent.Parent.Character.Torso <--- I don't know if I messed this bit up but it is a hopper bin which always stays in your backpack. They don't ever enter the player model even on equip. :/
function onButton1Down(mouse)
local b = Instance.new("Part")
b.BrickColor = BrickColor.new(217)
b.Positon = mouse.Hit.p
b.Rotation = torso.CFrame.lookVector <--- This is the rotation bit.
b.Size = Vector3.new(1, 10, 5)
b.Shape = 1
b.Parent = game.Workspace
b.Anchored = true


game:GetService("Debris"):AddItem(b, 500)
wait(.1)
script.Parent:Destroy()
end

function onSelected(mouse)
mouse.Button1Down:connect(function() onButton1Down(mouse) end)

end

script.Parent.Selected:connect(onSelected)

Report Abuse
vortexyamum is not online. vortexyamum
Joined: 31 Aug 2011
Total Posts: 1979
31 May 2014 11:42 PM
I'm going to see if I can do it with a tool instead of a hopper bin. It would seem much easier.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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