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
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Kick GUI according to distance

Previous Thread :: Next Thread 
Immortalibus is not online. Immortalibus
Joined: 23 Oct 2013
Total Posts: 6421
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 is not online. Jswagge
Joined: 15 Mar 2009
Total Posts: 2924
07 Jan 2014 04:55 PM
I'm going to take this script.
Report Abuse
Immortalibus is not online. Immortalibus
Joined: 23 Oct 2013
Total Posts: 6421
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 is not online. Jswagge
Joined: 15 Mar 2009
Total Posts: 2924
07 Jan 2014 04:59 PM
But I was joking about taking it.
Report Abuse
Immortalibus is not online. Immortalibus
Joined: 23 Oct 2013
Total Posts: 6421
07 Jan 2014 05:06 PM
Hm.
Bump.
Report Abuse
Jswagge is not online. 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
PiggyJingles is not online. PiggyJingles
Joined: 13 Jan 2009
Total Posts: 2472
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
Discommodate is not online. Discommodate
Joined: 06 Mar 2011
Total Posts: 14052
07 Jan 2014 05:09 PM
Your best teacher is the forums, js.
Report Abuse
Immortalibus is not online. Immortalibus
Joined: 23 Oct 2013
Total Posts: 6421
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
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