|
| 04 Nov 2012 05:25 AM |
Me and my friend (In RL) Have been working on this for 2 hours now but all of our solutions have failed. We are trying to remove tools when we enter a 'rest zone' and when we come out we will get our tools back.
We tried the torso position,head and model.
Man I really need help we cannot continue with the game until we get this done. (The rest zone will be destroyed by noobs without it) ____________ -JohnElijah-/Builder/Scripter/Creator |
|
|
| Report Abuse |
|
|
Monkey727
|
  |
| Joined: 12 Jan 2009 |
| Total Posts: 969 |
|
|
| 04 Nov 2012 05:32 AM |
You could try the Touched event In the Rest Zone's floor to delete the tools.
part.Touched:connect(function(hit) Player = game.Players:GetPlayerFromCharacter(hit.Parent) if Player then c = Player.Backpack:GetChildren() for i=1,#c do if c[i].ClassName == "Tool" or c[i].ClassName == "Hopperbin" then c[i]:Remove() end end end end)
And when you come out again, Touch another brick on the floor to Give the tools back from the Lighting or something. |
|
|
| Report Abuse |
|
|
|
| 04 Nov 2012 05:37 AM |
Yeah but those like to break over time. Maybe I can add a regen.
Well I will see what I can do.
Thanks!
____________ -JohnElijah-/Builder/Scripter/Creator |
|
|
| Report Abuse |
|
|
|
| 04 Nov 2012 05:46 AM |
You can use magnitude to see who is close to the rest area.
http://wiki.roblox.com/index.php/Magnitude
For example :
local part = game.Workspace.Part
while true do wait(2) local p = game.Players:GetPlayers() for i = 1, #p do if p[i].Character ~= nil then local torso = p[i].Character:FindFirstChild("Torso") if torso ~= nil then local magnitude = (part.Position - torso.Position).magnitude if magnitude < 20 then ----remove tools end end end end end
|
|
|
| Report Abuse |
|
|
Riderj
|
  |
| Joined: 15 Aug 2011 |
| Total Posts: 1534 |
|
|
| 04 Nov 2012 05:49 AM |
| Yes, magnitude does the distance from point a - b for you. |
|
|
| Report Abuse |
|
|
jobro13
|
  |
| Joined: 05 Aug 2009 |
| Total Posts: 2865 |
|
|
| 04 Nov 2012 05:50 AM |
| Magnitude returns the length of a vector, which in most cases is used as distance. However, it does NOT equal distance. |
|
|
| Report Abuse |
|
|
Aerideyn
|
  |
| Joined: 16 Jan 2010 |
| Total Posts: 1882 |
|
|
| 04 Nov 2012 06:11 AM |
| What do you mean? the length of a vector is the very definition of distance. |
|
|
| Report Abuse |
|
|
|
| 04 Nov 2012 06:15 AM |
| The vector could also be a Velocity Vector(ect.), hence it would not be distance? |
|
|
| Report Abuse |
|
|
Monkey727
|
  |
| Joined: 12 Jan 2009 |
| Total Posts: 969 |
|
|
| 04 Nov 2012 06:31 AM |
I managed to get it working using positioning. You would need to put in the deleting and cloning tools where it prints Inside and Outside Area. And since it's in a loop you would need to check to make sure the player already has the tools, Otherwise you would continously give them the same tools over and over again.
It takes positioning from a non-cancollidable part that fills the room, You could just enter the restpos and dimensions of the room manually though... LocalScript, in StarterGui.
-- Room Dimensions: part = game.Workspace["RestAreaPart"] restpos = part.CFrame -- Room Centre restxsize = part.Size.X /2 -- Distance from Centre to X Walls restysize = part.Size.Y /2 -- Distance from Centre to Y Walls restzsize = part.Size.Z /2 -- Distance from Centre to Z Walls
while true do
Player = game.Players.LocalPlayer if Player.Character then Torso = Player.Character:findFirstChild("Torso") if Torso then InArea = false if Torso.CFrame.X - restpos.X < restxsize then if Torso.CFrame.Y - restpos.Y < restysize then if Torso.CFrame.Z - restpos.Z < restzsize then if Torso.CFrame.X - restpos.X > -restxsize then if Torso.CFrame.Y - restpos.Y > -restysize then if Torso.CFrame.Z - restpos.Z > -restzsize then InArea = true end end end end end end
if InArea == true then print("Inside Area") else print("Outside Area") end
end end wait(0.5) end |
|
|
| Report Abuse |
|
|
Monkey727
|
  |
| Joined: 12 Jan 2009 |
| Total Posts: 969 |
|
|
| 04 Nov 2012 06:35 AM |
| Probably like the most complicated way of doing it x3 |
|
|
| Report Abuse |
|
|