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
 

brick in front of player

Previous Thread :: Next Thread 
Alimegacorn is not online. Alimegacorn
Joined: 24 May 2013
Total Posts: 899
20 Jul 2016 10:44 AM
i want this brick named,"Effect" to be in front of the player
i know this is the line of code thats messing up
the output is clean
shouldnt this work though?

line of code:

Effect.Position = plr.Character.Torso.CFrame.lookVector*1
Report Abuse
maxomega3 is not online. maxomega3
Joined: 11 Jun 2010
Total Posts: 10668
20 Jul 2016 10:48 AM
That would be inside the player, since anything multiplied by one is itself.
Report Abuse
Alimegacorn is not online. Alimegacorn
Joined: 24 May 2013
Total Posts: 899
20 Jul 2016 10:51 AM
the brick is appearing behind me for some reason
Report Abuse
maxomega3 is not online. maxomega3
Joined: 11 Jun 2010
Total Posts: 10668
20 Jul 2016 10:54 AM
that's a bit odd. Are you sure you've got your torso on right?

So I forgot that the lookVector is the position directly in front of CFrame.p of the object. Since your problem is that the brick is slightly behind you, all you have to do is negate the lookVector value.

somethingyouwantinfrontofyou.Position = myTorso.CFrame.lookVector * -1 -- tweak the value as you please
Report Abuse
Alimegacorn is not online. Alimegacorn
Joined: 24 May 2013
Total Posts: 899
20 Jul 2016 10:56 AM
wait no, my bad,

the brick is appearing in one spot only(a fixed position)
even if my torso faces another direction
it just looked like it was behind me at that time
i can post the whole script, but i doubt you would read it
Report Abuse
maxomega3 is not online. maxomega3
Joined: 11 Jun 2010
Total Posts: 10668
20 Jul 2016 11:03 AM
Oh, well that's just a problem of you not updating your own torso's position!
You need to have the position of the brick update when your torso moves by using a loop.

Given you have FE enabled, if you want yourself to only see the brick in front of you, you can use a local script and create a loop using RenderStepped, but likely you'll need to run it on the server side so everyone can see it. In that case, you can use an old fashioned while loop, or a possibly less expensive alternative of using a function that is connected to a change in your torso's position, but I'm not sure if changing position alerts the Changed event.

Good luck
Report Abuse
Alimegacorn is not online. Alimegacorn
Joined: 24 May 2013
Total Posts: 899
20 Jul 2016 11:16 AM
i got it fixed suprisingly

i just used CFrame instead of lookVector
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