wow75
|
  |
| Joined: 16 Jan 2009 |
| Total Posts: 951 |
|
|
| 06 Apr 2014 10:32 PM |
I feel like the problem is the position stuff, but it just straight doesn't work.
Character = script.Parent X = 1 local d = Character.HumanoidRootPart.Position while true do wait(X) if d.z <= 21.4 and d.z >= -11.6 and d.x <= -252.8 and d.x >= -285.8 and d.y < 40.7 then X = 0.1 for _,v in pairs(Character:GetChildren()) do if v.ClassName == "Part" and v.Name ~= "HumanoidRootPart" then if v.Name == "Head" then v.face.Transparency = 1 end v.Transparency = v.Transparency +0.075 elseif v.ClassName == "Hat" then v.Handle.Transparency = v.Handle.Transparency +0.075 end end else X = 1 for _,v in pairs(Character:GetChildren()) do if v.ClassName == "Part" and v.Name ~= "HumanoidRootPart" then if v.Name == "Head" then v.face.Transparency = 0 end v.Transparency = 0 elseif v.ClassName == "Hat" then v.Handle.Transparency = 0 end end end end
|
|
|
| Report Abuse |
|
|
Vexeris
|
  |
| Joined: 03 Apr 2014 |
| Total Posts: 468 |
|
|
| 06 Apr 2014 11:30 PM |
Character = script.Parent X = 1 local d = Character.Humanoid.Position while true do wait(X) if d.z <= 21.4 and d.z >= -11.6 and d.x <= -252.8 and d.x >= -285.8 and d.y < 40.7 then X = 0.1 for _,v in pairs(Character:GetChildren()) do if v.ClassName == "Part" and v.Name ~= "HumanoidRootPart" then if v.Name == "Head" then v.face.Transparency = 1 end v.Transparency = v.Transparency +0.075 elseif v.ClassName == "Hat" then v.Handle.Transparency = v.Handle.Transparency +0.075 end end else X = 1 for _,v in pairs(Character:GetChildren()) do if v.ClassName == "Part" and v.Name ~= "HumanoidRootPart" then if v.Name == "Head" then v.face.Transparency = 0 end v.Transparency = 0 elseif v.ClassName == "Hat" then v.Handle.Transparency = 0 end end end end |
|
|
| Report Abuse |
|
|
|
| 06 Apr 2014 11:52 PM |
Delete out everything that contains else. That is unnecessary, right?
Try disabling the if (position) then statement and it's end and run it normally. |
|
|
| Report Abuse |
|
|
wow75
|
  |
| Joined: 16 Jan 2009 |
| Total Posts: 951 |
|
|
| 07 Apr 2014 06:32 PM |
| Well I'd like them to become visible once they leave the area. When I took out the else it worked, but only if I pasted the script in his character when he was in the area. If I tried anywhere else, it wouldn't work, and no output either. So it seems like it's just checking once and then stopping. |
|
|
| Report Abuse |
|
|
wow75
|
  |
| Joined: 16 Jan 2009 |
| Total Posts: 951 |
|
|
| 09 Apr 2014 11:42 AM |
So I made a really dumbed down version and even that doesn't work...
Character = script.Parent local d = Character.Head.Position while true do if d.z <= 21.4 and d.z >= -11.6 and d.x <= -252.8 and d.x >= -285.8 and d.y < 40.7 then print("IN ZONE") else --other stuff end wait(0.1) end |
|
|
| Report Abuse |
|
|
powertool
|
  |
| Joined: 01 Feb 2008 |
| Total Posts: 3771 |
|
|
| 09 Apr 2014 12:50 PM |
| Check if the Player's HumanoidRootPart is in a Region3 that you want him/her to be invisible in, if so, set all Parts of that Character invisible. Then, if he walks out (Surround with Region3's on all 6 sides?), set all the parts except for the HumanoidRootPart back to visible. |
|
|
| Report Abuse |
|
|
wow75
|
  |
| Joined: 16 Jan 2009 |
| Total Posts: 951 |
|
|
| 09 Apr 2014 05:02 PM |
| Looked it up on the wiki, perfect solution. But how do I find out if it's inside it? FindPartsInRegion3 seems like it wouldn't quite work... |
|
|
| Report Abuse |
|
|
wow75
|
  |
| Joined: 16 Jan 2009 |
| Total Posts: 951 |
|
|
| 09 Apr 2014 05:35 PM |
LENGHTY SCRIPT AHEAD
So here's what I've got.
Character = script.Parent local d = Character.HumanoidRootPart local RE = Region3.new(Vector3.new(-285.9, 12.5, -11.7),Vector3.new(-252.7, 44.2, 21.5)) while true do local tab = {} for i = 1, #game.Workspace:FindPartsInRegion3(RE,nil,100) do table.insert(tab, i, game.Workspace:FindPartsInRegion3(RE,nil,100)[i]) end for _,v in pairs(tab) do if v == d then for _,v in pairs(Character:GetChildren()) do if v.ClassName == "Part" and v.Name ~= "HumanoidRootPart" then if v.Name == "Head" then v.face.Transparency = 1 end v.Transparency = v.Transparency +0.075 elseif v.ClassName == "Hat" then v.Handle.Transparency = v.Handle.Transparency +0.075 end end else for _,v in pairs(Character:GetChildren()) do if v.ClassName == "Part" and v.Name ~= "HumanoidRootPart" then if v.Name == "Head" then v.face.Transparency = 0 end v.Transparency = 0 elseif v.ClassName == "Hat" then v.Handle.Transparency = 0 end end end end for c = 1,100 do table.remove(tab,1) if #tab == 0 then break end end wait(2) end |
|
|
| Report Abuse |
|
|
MTamidex
|
  |
| Joined: 17 Oct 2013 |
| Total Posts: 1092 |
|
|
| 09 Apr 2014 05:37 PM |
| It would be easier to make a brick that when you're touching it makes you invisible, but since you want to make it with areas fine. |
|
|
| Report Abuse |
|
|
wow75
|
  |
| Joined: 16 Jan 2009 |
| Total Posts: 951 |
|
|
| 09 Apr 2014 05:42 PM |
| Im not really sure how to do that though, like, if you're totally submerged in a brick, it no longer counts collisions; edge on edge contact is considered a touch. And of course, he has to become visible when he leaves, which I think will just be plethora of problems. |
|
|
| Report Abuse |
|
|
|
| 09 Apr 2014 05:49 PM |
Here is the problem:
local d = Character.Head.Position --store a variable with the head's position
while true do if (d stuff) then --oh wait, THE D VARIABLE DOESN'T UPDATE! --stuff end end
You can't define the variable with the position inside of it. Try this:
local d = Character.Head
while true do if (d.Position.X >= blah blah) then --now the position gets updated every loop --stuff end end
|
|
|
| Report Abuse |
|
|
MTamidex
|
  |
| Joined: 17 Oct 2013 |
| Total Posts: 1092 |
|
|
| 09 Apr 2014 05:51 PM |
use the .Touched event like
player = game.Players.LocalPlayer
function onTouched(hit) if (hit.Parent:findFirstChild("Humanoid") then player.Torso.Transparency = 1 player.LeftArm.Transparency = 1 player.RightArm.Transparency = 1 player.LeftLeg.Transparency = 1 player.RightLeg.Transparency = 1 end
game.Workspace.InvisibilityBrick.Touched:connect(onTouched)
I will test it and tell you if works |
|
|
| Report Abuse |
|
|
|
| 09 Apr 2014 05:52 PM |
@MT
He's looking for the character to go invisible if they enter an area, not if they touch a part. |
|
|
| Report Abuse |
|
|
wow75
|
  |
| Joined: 16 Jan 2009 |
| Total Posts: 951 |
|
|
| 09 Apr 2014 05:56 PM |
| Clever clever! That explains literally everything. xD |
|
|
| Report Abuse |
|
|
MTamidex
|
  |
| Joined: 17 Oct 2013 |
| Total Posts: 1092 |
|
|
| 09 Apr 2014 06:01 PM |
| yeah but is my script functional? i like to help |
|
|
| Report Abuse |
|
|
Azureous
|
  |
| Joined: 29 Jan 2012 |
| Total Posts: 25287 |
|
|
| 09 Apr 2014 06:03 PM |
local Pos1=CornerBrick1.Position; local Pos2=CornerBrick2.Position; local Region=Region3.new(Pos1,Pos2); while true do Spawn(function() for Index,Value in pairs(Workspace:FindPartInRegion3(Region,nil,1000) do if Value:IsA("Head") and Value.Parent.Name==("Character") then Spawn(function() local player=game.Players:GetPlayerFromCharacter(Value.Parent); for Index=1,#player.Character:GetChildren() do player.Character:GetChildren()[Index].Transparency=1; end end) end end end) end |
|
|
| Report Abuse |
|
|
wow75
|
  |
| Joined: 16 Jan 2009 |
| Total Posts: 951 |
|
|
| 09 Apr 2014 06:04 PM |
| Yes yours would work, but when I leave the area, I would still be invisible. Also some crafty sausage would probably just keep touching the brick over and over and glitch themselves invisible. |
|
|
| Report Abuse |
|
|
MTamidex
|
  |
| Joined: 17 Oct 2013 |
| Total Posts: 1092 |
|
| |
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
| |
|