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: Teleport help

Previous Thread :: Next Thread 
imcoolfire8 is not online. imcoolfire8
Joined: 23 Nov 2009
Total Posts: 3008
15 Apr 2012 04:26 PM
im trying to make it so that if your not a zombie you are able to teleport
but now it just makes it so that zombies teleport!
the output says
17:23:14 - Zombie is not a valid member of Model
17:23:14 - Script "Workspace.Teletrip.TeleTo.Teleport", Line 11
17:23:14 - stack end
modelname="TeleFro"
function onTouched(part)
if part.Parent ~= nil then
local h = part.Parent:findFirstChild("Humanoid")
if h~=nil then
local teleportfrom=script.Parent.Enabled.Value
if teleportfrom~=0 then
if h==humanoid then
return
end
if h.Parent.Zombie == nil then --HELP!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
local teleportto=script.Parent.Parent:findFirstChild(modelname)
if teleportto~=nil then
local torso = h.Parent.Torso
local location = {teleportto.Position}
local i = 1

local x = location[i].x
local y = location[i].y
local z = location[i].z

x = x + math.random(-1, 1)
z = z + math.random(-1, 1)
y = y + math.random(2, 3)

local cf = torso.CFrame
local lx = 0
local ly = y
local lz = 0

script.Parent.Enabled.Value=0
teleportto.Enabled.Value=0
torso.CFrame = CFrame.new(Vector3.new(x,y,z), Vector3.new(lx,ly,lz))
wait(3)
script.Parent.Enabled.Value=1
teleportto.Enabled.Value=1
else
print("Could not find teleporter!")
end
end
end
end
end
end
script.Parent.Touched:connect(onTouched)
Report Abuse
breuning is not online. breuning
Joined: 30 Oct 2008
Total Posts: 4268
15 Apr 2012 04:28 PM
if h.Parent.Name ~= "Zombie" then -- Did you mean this?
Report Abuse
imcoolfire8 is not online. imcoolfire8
Joined: 23 Nov 2009
Total Posts: 3008
15 Apr 2012 04:34 PM
No because i meant a zombie NPC and these zombies have certan scripts that show there health at very random HP and Zombie is a value i put in zombies
Report Abuse
breuning is not online. breuning
Joined: 30 Oct 2008
Total Posts: 4268
15 Apr 2012 04:37 PM
if h.Parent:findFirstChild("Zombie") == nil then
Report Abuse
imcoolfire8 is not online. imcoolfire8
Joined: 23 Nov 2009
Total Posts: 3008
15 Apr 2012 04:46 PM
Why thanks
Report Abuse
breuning is not online. breuning
Joined: 30 Oct 2008
Total Posts: 4268
15 Apr 2012 04:59 PM
Non Zombies don't have the value , so the script cant access it. It like
Workspace.NonExistantPart:Remove()

If there is no NonExistantPart, the script will fail.

findFirstChild() checks if it is there and gets the first object with the name. It returns true or false.
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