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: How would you make something..

Previous Thread :: Next Thread 
Mico161lol is not online. Mico161lol
Joined: 30 Oct 2009
Total Posts: 4769
10 Feb 2014 07:14 PM
Formed in front of you wherever you go

Like you use a key input to make a brick pop up when you press B

like this


local cooldown = false
function Snakebite()
local brick = Instance.new("Part")
brick.Parent = game.Workspace
brick.Name = "Venom"
brick.Size = Vector3.new(10,10,10)
brick.BrickColor = BrickColor.Green()
end
local tool = script.Parent
tool.Selected:connect(function(mouse)
mouse.KeyDown:connect(function(key)
if key == "b" and (not cooldown) then
cooldown = true
print("The poison is sinking into our victim!")
Snakebite()
wait(4) --Cooldown time for "Snakebite"
cooldown = false
end
end)
end)



then the brick appears where you spawn (without the spawnpoints) every single time, how would we make it so that it appears in front of you every time like in the direction you face?
Report Abuse
solvar is not online. solvar
Joined: 22 May 2011
Total Posts: 149
10 Feb 2014 07:20 PM
I'm pretty sure you need to do this

local cooldown = false
function Snakebite()
local brick = Instance.new("Part")
brick.Parent = game.Workspace
brick.Name = "Venom"
brick.Size = Vector3.new(10,10,10)
brick.BrickColor = BrickColor.Green()
brick.CFrame = game.Players.LocalPlayer.Character.Torso.CFrame.lookVector * CFrame.new(0,0,-3)
end
local tool = script.Parent
tool.Selected:connect(function(mouse)
mouse.KeyDown:connect(function(key)
if key == "b" and (not cooldown) then
cooldown = true
print("The poison is sinking into our victim!")
Snakebite()
wait(4) --Cooldown time for "Snakebite"
cooldown = false
end
end)
end)
Report Abuse
Mico161lol is not online. Mico161lol
Joined: 30 Oct 2009
Total Posts: 4769
10 Feb 2014 07:44 PM
17:43:52.332 - attempt to multiply a Vector3 with an incompatible value type or nil; returning new zero-vector
17:43:52.333 - Players.Player1.Backpack.PoisonMagic.Magic:8: bad argument #3 to 'CFrame' (CFrame expected, got userdata)


that's what I got when I tried your suggestion, worked once

broke after
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
10 Feb 2014 07:47 PM
take off the "lookVector" part
thing.CFrame = otherthing.CFrame*CFrame.new(0,0,1)-- it might be "-1" not one,but try it anyway
Report Abuse
solvar is not online. solvar
Joined: 22 May 2011
Total Posts: 149
10 Feb 2014 07:50 PM
wait so it broke when you tried to do it again or right after it spawned?
Report Abuse
solvar is not online. solvar
Joined: 22 May 2011
Total Posts: 149
10 Feb 2014 07:51 PM
@island

it wont put it in front of his torso
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
10 Feb 2014 07:53 PM
behind then?
ik it works..
try this
p1 = Instance.new("Part",Workspace)
p2 = Instance.new("Part",Workspace)
p1.CFrame = p2.CFrame*CFrame.new(0,0,2)
Report Abuse
Mico161lol is not online. Mico161lol
Joined: 30 Oct 2009
Total Posts: 4769
10 Feb 2014 07:53 PM
it worked but spawned at the same place didnt spawn in front of me

all it did was break after
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
10 Feb 2014 07:55 PM
oop,forgot
p1.Position = Vector3.new(0,0,5)
p2.Position = Vector3.new(0,0,10)
so theyre not attached..
Report Abuse
solvar is not online. solvar
Joined: 22 May 2011
Total Posts: 149
10 Feb 2014 08:00 PM
@island

It wont spawn in front of him

Torso.CFrame.lookVector is which way his torso is looking
Report Abuse
lolb3 is not online. lolb3
Joined: 16 Jan 2010
Total Posts: 2268
10 Feb 2014 08:02 PM
yet CFrame uses a part's local space. logic pls ^
Report Abuse
solvar is not online. solvar
Joined: 22 May 2011
Total Posts: 149
10 Feb 2014 08:04 PM
@lol

But he still wants it to face the direction of the player
Report Abuse
lolb3 is not online. lolb3
Joined: 16 Jan 2010
Total Posts: 2268
10 Feb 2014 08:08 PM
yes.. CFrame uses local space
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
10 Feb 2014 08:10 PM
lol,if u try to use .lookVector and CFrame
itll error,because ur trying to set a vectorvalue to a cframe,which doesn't work
Report Abuse
solvar is not online. solvar
Joined: 22 May 2011
Total Posts: 149
10 Feb 2014 08:10 PM
Alright so if waht @lol says works then try it take out the lookVector
Report Abuse
Mico161lol is not online. Mico161lol
Joined: 30 Oct 2009
Total Posts: 4769
10 Feb 2014 08:15 PM
ty island, it worked!
Report Abuse
Mico161lol is not online. Mico161lol
Joined: 30 Oct 2009
Total Posts: 4769
10 Feb 2014 08:16 PM
nevermind, slight problem with a big brick like this, it appears to kind of sink into the baseplate and doesn't seem to move (which I'm trying to make launch with bodythrust)
Report Abuse
solvar is not online. solvar
Joined: 22 May 2011
Total Posts: 149
10 Feb 2014 08:23 PM
Use BodyVelocity
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
10 Feb 2014 08:28 PM
Why do people make it harder than it has to be?

local studsInFront = 10
local cframe = part.CFrame

local newCFrame = cframe * CFrame.new(0, 0, -studsInFront)

newCFrame is 'studsInFront' studs in front of 'newCFrame'
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
10 Feb 2014 08:46 PM
yeah...what cnt said:3
that's what I was kinda trying to say,but..idk

on a side note,heres a random brick spawner!

wont let me post...
ugh...
ill just make it a FM
http://www.roblox.com/RandomBrickMaker-item?id=145773860
Report Abuse
solvar is not online. solvar
Joined: 22 May 2011
Total Posts: 149
10 Feb 2014 08:51 PM
But there is a slight problem @cnt if his character was up against the wall he could shoot thru walls! idk if he wants this but yeah i know i wouldnt
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
10 Feb 2014 08:52 PM
that's true,but no matter what,it will still do that
Report Abuse
Mico161lol is not online. Mico161lol
Joined: 30 Oct 2009
Total Posts: 4769
10 Feb 2014 08:52 PM
lol, for some reason the script cnt gave me doesn't work

probably because I derped it up
Report Abuse
Bebee2 is not online. Bebee2
Joined: 17 May 2009
Total Posts: 3985
10 Feb 2014 08:54 PM
Did you set the CFrame to newCFrame?
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
10 Feb 2014 11:33 PM
You could just use raycasting in a length of the offset in front of the current cframe to see if anything is in the way.

So you may have something like this:

local studsInFront = 10
local cframe = workspace.Part.CFrame
local newcframe = cframe * CFrame.new(0, 0, -studsInFront)

if workspace:FindPartOnRay(Ray.new(cframe.p, (newcframe.p - cframe.p)), workspace.Part) then
print("Something is in the way")
else
workspace.Part.CFrame = newcframe
print("Success")
end
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