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: How do I check this?

Previous Thread :: Next Thread 
Twistir is not online. Twistir
Joined: 19 Nov 2009
Total Posts: 12374
21 Mar 2015 11:03 PM
How do I check for when a player gets near a brick?
Report Abuse
AbstractMadness is not online. AbstractMadness
Joined: 22 Dec 2014
Total Posts: 20425
21 Mar 2015 11:07 PM
How the hell are you in RBXDev?

Anyways,

if (part.Position - char.Torso.Position).magnitude == 5 then
print("you are 5 studs away from the part")
Report Abuse
amanda is not online. amanda
Joined: 21 Nov 2006
Total Posts: 5925
21 Mar 2015 11:07 PM
you get the players torso or head, whichever, i recommend torso however

and you get the brick

and be all like

local magnitude = (brick.Position - torso.Position).magnitude

and that will return the distance between a player and a part, but only once so you need to constantly check for it somehow
Report Abuse
amanda is not online. amanda
Joined: 21 Nov 2006
Total Posts: 5925
21 Mar 2015 11:08 PM
@abs

end
Report Abuse
AbstractMadness is not online. AbstractMadness
Joined: 22 Dec 2014
Total Posts: 20425
21 Mar 2015 11:08 PM
thanks babe, you're always there to fix my mistakes
Report Abuse
amanda is not online. amanda
Joined: 21 Nov 2006
Total Posts: 5925
21 Mar 2015 11:09 PM
btw

rblxdev is also for good builders

if you look at his places and models u can see some nice stuff
Report Abuse
Twistir is not online. Twistir
Joined: 19 Nov 2009
Total Posts: 12374
21 Mar 2015 11:09 PM
thank you
Report Abuse
AbstractMadness is not online. AbstractMadness
Joined: 22 Dec 2014
Total Posts: 20425
21 Mar 2015 11:11 PM
@amanda

i don't see anything
Report Abuse
Twistir is not online. Twistir
Joined: 19 Nov 2009
Total Posts: 12374
21 Mar 2015 11:12 PM
okay so I am trying to make an egg

How would I get the char? I cant use a local script can I?
Report Abuse
CrowClaws is not online. CrowClaws
Joined: 04 Jul 2010
Total Posts: 4466
21 Mar 2015 11:13 PM
HOW ARE YOU IN RBXDEV!?!?!
Report Abuse
Twistir is not online. Twistir
Joined: 19 Nov 2009
Total Posts: 12374
21 Mar 2015 11:14 PM
alright looks like im not going to have a primary when I'm here
Report Abuse
AbstractMadness is not online. AbstractMadness
Joined: 22 Dec 2014
Total Posts: 20425
21 Mar 2015 11:15 PM
I literally can't see how you're in RBXDev.. hmu I wanna get in.

For the egg, put this in the egg

local egg = script.Parent
local distance = 5 -- studs you wanna be away from the egg

while wait() do
if (egg.Position - torso.Position).magnitude <= 5 then
print("you are 5 studs away from the egg")
end
end
Report Abuse
amanda is not online. amanda
Joined: 21 Nov 2006
Total Posts: 5925
21 Mar 2015 11:17 PM
You could definitely use a local script. The biggest mistake people do is getting the player and not the character however.

This is a solid way to get the character in a localscript:

local player = game:GetService("Players").LocalPlayer

local character = player.Character
if not character or not character.Parent then
character = player.CharacterAdded:wait()
end

local part = game.Workspace.KillBrick

--then you could just do

while true do
wait(1)
if (character.Torso.Position - part.Position).magnitude < 15 then
character.Humanoid.Health = 0
end
end

or something, that's just a test script to see if it works, the 15 is measured in studs, i would test that number a lot
Report Abuse
Twistir is not online. Twistir
Joined: 19 Nov 2009
Total Posts: 12374
21 Mar 2015 11:17 PM
but how do I find the torsooo ;-;
Report Abuse
amanda is not online. amanda
Joined: 21 Nov 2006
Total Posts: 5925
21 Mar 2015 11:17 PM
abs you are right about the shorter wait :(
Report Abuse
Twistir is not online. Twistir
Joined: 19 Nov 2009
Total Posts: 12374
21 Mar 2015 11:18 PM
thanks amanda
Report Abuse
AbstractMadness is not online. AbstractMadness
Joined: 22 Dec 2014
Total Posts: 20425
21 Mar 2015 11:20 PM
dont use a localscript

do this

local plrs = game:service("Players"):GetPlayers()

while wait() do
for _,v in next, plrs do
if (egg.Position - plrs.Character.Torso).magnitude <= then
--yayayaya
end
end
end

Report Abuse
micke3212 is not online. micke3212
Joined: 24 Nov 2009
Total Posts: 3000
21 Mar 2015 11:22 PM
I'm forwarding this post to the owner.... How dare you be in that group when we know more...
Report Abuse
Twistir is not online. Twistir
Joined: 19 Nov 2009
Total Posts: 12374
21 Mar 2015 11:29 PM
im trying to make the egg fly away when you get near it

no output

local plrs = game:service("Players"):GetPlayers()
egg = script.Parent
bthrust = egg.BodyThrust

while wait() do
for _,v in next, plrs do
if (egg.Position - plrs.Character.Torso).magnitude <= 5 then
bthrust.force = Vector3.new(0,7000,2000)
wait(.1)
bthrust.force = Vector3.new(0,0,0)
end
end
end
Report Abuse
amanda is not online. amanda
Joined: 21 Nov 2006
Total Posts: 5925
21 Mar 2015 11:31 PM
"egg = script.Parent"

You can't put localscripts in eggs

you have to put the localscript in startergui

reference the egg the long way
Report Abuse
Twistir is not online. Twistir
Joined: 19 Nov 2009
Total Posts: 12374
21 Mar 2015 11:31 PM
its a normal script now though
Report Abuse
amanda is not online. amanda
Joined: 21 Nov 2006
Total Posts: 5925
21 Mar 2015 11:31 PM
oh you didn't use a localscript

need to rethink that one sec
Report Abuse
micke3212 is not online. micke3212
Joined: 24 Nov 2009
Total Posts: 3000
21 Mar 2015 11:34 PM
Don't tell your part of that Dev Hunt project....
Report Abuse
Twistir is not online. Twistir
Joined: 19 Nov 2009
Total Posts: 12374
21 Mar 2015 11:35 PM
im not apart of it, but I want to try and make my own eggs because it sounds like fun.
Report Abuse
micke3212 is not online. micke3212
Joined: 24 Nov 2009
Total Posts: 3000
21 Mar 2015 11:36 PM
Not really... Most people dislike it, it's more of a 75% dislike and 25% like the idea.


A lot of people just want one game where all the eggs are scattered, however I will say your game would be nice with eggs. Especially if you added certain features if you gathered them.
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