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
We use cookies to offer you a better experience. By using Roblox.com, you are agreeing to our Privacy and Cookie Policy.
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Help? Radar system..

Previous Thread :: Next Thread 
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
26 Sep 2014 12:55 AM
ok, this is probably a lil ugly lookin code..
but basicly, I have a system which sorts out the teams already, and I have it in workspace, so that isn't a problem, theres also no errors..

basicly, if its a team mate, itll create a green block on the 'radar' and get the distance between the plr and the other

but its not workin, no errors.. I'm a lil rusty at this, so I'm not sure whats wrong..


things = {Clear = function() for i=1,things do things[i]:Destroy() end end}
p = script.Parent
radar = p
repeat p = p.Parent until p:IsA("Player")
print("Welcome "..p.Name.."!")
repeat wait() until p.Character
wait()
num = 0
Team = workspace.Teams:FindFirstChild(p.Name,true).Parent.Parent.Name
local x,z,team
Create = function(X,Y,char)
team = workspace.Teams:FindFirstChild(char.Name,true).Parent.Parent.Name
if team == Team then
local obj = radar.nme:clone()
obj.Position = radar.Position+UDim2.new(0,0.05*X,0,0.05*Y)
obj.Parent = radar
things[num] = obj
end
end
CalculateDist = function(plr,other)
local pos1 = plr.Torso.Position
local pos2 = other.Torso.Position

if pos1.Z>pos2.Z then
z = pos1.Z-pos2.Z
else
z = pos2.Z-pos1.Z
end

if pos1.X>pos2.X then
x = pos1.X-pos2.X
else
x = pos2.X-pos1.X
end
return {x,z}
end
while wait() do
for i,v in pairs(game.Players:GetChildren()) do
if v.Name~=p.Name and v.Character~=nil then
num = num+1
distanceX = CalculateDist(p.Character,v.Character)[1]
distanceZ = CalculateDist(p.Character,v.Character)[2]
Create(distanceX,distanceZ,v)
end
end
wait()
things:Clear()
end
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
26 Sep 2014 01:03 AM
wow, why wasn't the error showing up..?

#things, not just things..
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
26 Sep 2014 01:23 AM
probbbbbllllllleeeeeeeemmmmmmm

its not working.. AGAIN


things = {Clear = function() for i=1,#things do things[i]:Destroy() num = 0 end end}
p = script.Parent
radar = p.Radar
repeat p = p.Parent until p:IsA("Player")
print("Welcome "..p.Name.."!")
repeat wait() until p.Character
wait()
num = 0
Team = workspace.Teams:FindFirstChild(p.Name,true).Parent.Parent.Name
local x,z,team
Create = function(X,Y,char)
team = workspace.Teams:FindFirstChild(char.Name,true).Parent.Parent.Name
if team == Team then
obj = radar.helper:clone()
else
obj = radar.nme:clone()
end
obj.Rotation = char.Torso.Rotation.Y-45
obj.Position = UDim2.new(0.5,0,0.45,0)+UDim2.new(0.05*X,0,0.05*Y,0)
obj.Parent = radar
obj.Visible = true
things[num] = obj
end
CalculateDist = function(plr,other)
local pos1 = plr.Torso.Position
local pos2 = other.Torso.Position

if pos1.Z>pos2.Z then
z = pos1.Z-pos2.Z
else
z = pos2.Z-pos1.Z
end

if pos1.X>pos2.X then
x = pos1.X-pos2.X
else
x = pos2.X-pos1.X
end
return {x,z}
end
while wait() do
for i,v in pairs(game.Players:GetChildren()) do
if v.Name~=p.Name and v.Character~=nil then
num = num+1
distanceX = CalculateDist(p.Character,v.Character)[1]
distanceZ = CalculateDist(p.Character,v.Character)[2]
Create(distanceX,distanceZ,v)
end
end
wait(0.2)
things:Clear()
end
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
26 Sep 2014 01:31 AM
HELP!!!!
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
26 Sep 2014 01:44 AM
CalculateDist = function(plr, oplr)... returns a value rather than a function, I'm sure?
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