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 |
|
|
|
| 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
|
  |
| 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
|
  |
| Joined: 21 Nov 2006 |
| Total Posts: 5925 |
|
| |
|
|
| 21 Mar 2015 11:08 PM |
| thanks babe, you're always there to fix my mistakes |
|
|
| Report Abuse |
|
|
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
|
  |
| Joined: 19 Nov 2009 |
| Total Posts: 12374 |
|
| |
|
|
| 21 Mar 2015 11:11 PM |
@amanda
i don't see anything |
|
|
| Report Abuse |
|
|
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
|
  |
| Joined: 04 Jul 2010 |
| Total Posts: 4466 |
|
|
| 21 Mar 2015 11:13 PM |
| HOW ARE YOU IN RBXDEV!?!?! |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 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
|
  |
| 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
|
  |
| Joined: 19 Nov 2009 |
| Total Posts: 12374 |
|
|
| 21 Mar 2015 11:17 PM |
| but how do I find the torsooo ;-; |
|
|
| Report Abuse |
|
|
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
|
  |
| Joined: 19 Nov 2009 |
| Total Posts: 12374 |
|
| |
|
|
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| Joined: 19 Nov 2009 |
| Total Posts: 12374 |
|
|
| 21 Mar 2015 11:31 PM |
| its a normal script now though |
|
|
| Report Abuse |
|
|
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
|
  |
| 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
|
  |
| 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
|
  |
| 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 |
|
|