|
| 07 Jan 2014 04:54 PM |
So, I have a GUI that you enter a players name and click Kick, and if they are within a 37 stud radius of the middle of an area (defined by a part) it will LoadCharacter() them.
Nothing comes up in the output and nothing happens when tested. The hierarchies are correct, but I'm guessing the logic of the script isn't. Where did I go wrong?
zoneowner = script.Parent.Parent.Parent.Parent.Parent.Parent zonenum = zoneowner:WaitForChild("Values").ZoneNumber
while true do if zonenum == 1 then zone = Workspace.Zone1 elseif zonenum == 2 then zone = Workspace.Zone2 elseif zonenum == 3 then zone = Workspace.Zone3 elseif zonenum == 4 then zone = Workspace.Zone4 elseif zonenum == 5 then zone = Workspace.Zone5 elseif zonenum == 6 then zone = Workspace.Zone6 elseif zonenum == 7 then zone = Workspace.Zone7 elseif zonenum == 8 then zone = Workspace.Zone8 elseif zonenum == 9 then zone = Workspace.Zone9 elseif zonenum == 10 then zone = Workspace.Zone10 end wait() end
script.Parent.MouseButton1Click:connect(function() name = script.Parent.Parent.BeingKicked.Text kicked = game.Players:findFirstChild(name) char = kicked.Character dist = (char.Torso.Position - zone.Middle.Position).magnitude if dist < 37 then kicked:LoadCharacter() end end) |
|
|
| Report Abuse |
|
|
Jswagge
|
  |
| Joined: 15 Mar 2009 |
| Total Posts: 2924 |
|
|
| 07 Jan 2014 04:55 PM |
| I'm going to take this script. |
|
|
| Report Abuse |
|
|
|
| 07 Jan 2014 04:56 PM |
| You can but it doesn't work. That's why I posted it here, looking for assistance. |
|
|
| Report Abuse |
|
|
Jswagge
|
  |
| Joined: 15 Mar 2009 |
| Total Posts: 2924 |
|
|
| 07 Jan 2014 04:59 PM |
| But I was joking about taking it. |
|
|
| Report Abuse |
|
|
| |
|
Jswagge
|
  |
| Joined: 15 Mar 2009 |
| Total Posts: 2924 |
|
|
| 07 Jan 2014 05:07 PM |
| I've been looking for a scripting teacher though, maybe you could be the one to teach me. I am devoting all the time I have left to learning it. |
|
|
| Report Abuse |
|
|
|
| 07 Jan 2014 05:09 PM |
This is an eyesore, fixing it up for you
zoneowner = script.Parent.Parent.Parent.Parent.Parent.Parent zonenum = zoneowner:WaitForChild("Values").ZoneNumber
while true do for i=1, 10 do if zonenum == i then zone = game.Workspace["Zone"..i] end end wait() end
script.Parent.MouseButton1Click:connect(function() name = script.Parent.Parent.BeingKicked.Text kicked = game.Players:findFirstChild(name) char = kicked.Character dist = (char.Torso.Position - zone.Middle.Position).magnitude if dist < 37 then kicked:LoadCharacter() end end) |
|
|
| Report Abuse |
|
|
|
| 07 Jan 2014 05:09 PM |
| Your best teacher is the forums, js. |
|
|
| Report Abuse |
|
|
|
| 07 Jan 2014 05:21 PM |
Thank you for tidying up the code, but it didn't fix it. There are no output errors for some reason, either. |
|
|
| Report Abuse |
|
|