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: Teleporting to the VIP

Previous Thread :: Next Thread 
mixter13 is not online. mixter13
Joined: 12 Apr 2008
Total Posts: 49
17 Oct 2011 08:57 PM
I just wanna make a script to teleport me to a VIP room when a model called VIPTeleport is touched.

player = nil
tele = game.Workspace.VIPTeleport.Torso
target = Vector3.new(20, 663.2, -20) --...and this

function onTouch(part)
--Set the value of "player" to the player's name
player.Character.Torso.CFrame = target --teleport the player
end

function fadeTo(a, b, c)
for transparency = a, b, c do
--go from a to b, counting by c

for _, part in pairs(player.Character:GetChildren()) do
--for each of the objects in the character,

if part:IsA("BasePart") then
--check if it's a part, and if so

part.Transparency = transparency
--set its transparency
end
end
wait(0.1)
end
end

fadeTo(0, 1, 0.1) --fade out,
script.Parent.Touched:connect(onTouched)
fadeTo(1, 0, -0.1) --fade back in

So far, that's what I've got. I only need help on setting the value of "player".
Report Abuse
GoldenUrg is not online. GoldenUrg
Joined: 23 Aug 2009
Total Posts: 6428
17 Oct 2011 09:36 PM
player = Game.Players:GetPlayerFromCharacter(part.Parent)
Report Abuse
4444vince2 is not online. 4444vince2
Joined: 08 Nov 2008
Total Posts: 4880
17 Oct 2011 10:57 PM
make it Check for T-Shirt?
Report Abuse
mixter13 is not online. mixter13
Joined: 12 Apr 2008
Total Posts: 49
18 Oct 2011 06:10 PM
I already have a vip door to the teleport brick.
Report Abuse
mixter13 is not online. mixter13
Joined: 12 Apr 2008
Total Posts: 49
18 Oct 2011 06:12 PM
I also meant to set the player value to the player's name.
Report Abuse
GoldenUrg is not online. GoldenUrg
Joined: 23 Aug 2009
Total Posts: 6428
18 Oct 2011 06:53 PM
player.Character won't work if "player" is a name. You can get the player.Name or the character name (usually hit.Parent.Name).
Report Abuse
mixter13 is not online. mixter13
Joined: 12 Apr 2008
Total Posts: 49
18 Oct 2011 08:06 PM
Wait, how do I apply that?
Report Abuse
GoldenUrg is not online. GoldenUrg
Joined: 23 Aug 2009
Total Posts: 6428
18 Oct 2011 08:18 PM
function onTouch(part)
--Set the value of "player" to the player of that part
player = Game.Players:GetPlayerFromCharacter(part.Parent)
if( player ) then
player.Character.Torso.CFrame = target --teleport the player
end
end
Report Abuse
mixter13 is not online. mixter13
Joined: 12 Apr 2008
Total Posts: 49
19 Oct 2011 06:08 PM
Still doesn't work. The error:

Workspace.VIPTeleport.Torso.Script:17:attempt to index global 'player' (a nil value)

How do I fix this error at line 17?
Report Abuse
mixter13 is not online. mixter13
Joined: 12 Apr 2008
Total Posts: 49
21 Oct 2011 06:24 PM
bump, now I have a new script.

player = nil
tele = game.Workspace.VIPTeleport.Torso
target = Vector3.new(20, 663.2, -20) --...and this

function onTouch(part)
if game.Players:findFirstChild(part.Parent.Name) then
player = game.Players[part.Parent.Name]
player.Character.Torso.CFrame = target --teleport the player
end
end

function fadeTo(a, b, c)
for transparency = a, b, c do
--go from a to b, counting by c

for _, part in pairs(player.Character:GetChildren()) do
--for each of the objects in the character,

if part:IsA("BasePart") then
--check if it's a part, and if so

part.Transparency = transparency
--set its transparency
end
end
wait(0.1)
end
end

fadeTo(0, 1, 0.1) --fade out,
script.Parent.Touched:connect(onTouched)
fadeTo(1, 0, -0.1) --fade back in

The error says that:
Workspace.VIPTeleport.Torso.Script:16: attempt to index global 'player' (a nil value)
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