|
| 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 |
|
|
|
| 26 Sep 2014 01:03 AM |
wow, why wasn't the error showing up..?
#things, not just things.. |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
| |
|
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 |
|
|