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 » Scripters
Home Search
 

Re: Mousebutton1:connect teleport?

Previous Thread :: Next Thread 
Xarkos is not online. Xarkos
Joined: 15 Jul 2015
Total Posts: 2210
20 Sep 2015 04:11 PM
script.Parent.MouseButton1Click:connect(function()
game:GetService("TeleportService"):Teleport(299047057, player)
end

for some reason it's not working, can anyone help?


Patience is key 🔐
Report Abuse
Luxurize is not online. Luxurize
Joined: 31 Mar 2015
Total Posts: 1289
20 Sep 2015 04:13 PM
And whom is 'Player'?


“Insane isn't always black or white. We're all pathological, in our own ways.”
Report Abuse
Darkenus is not online. Darkenus
Joined: 17 Jul 2014
Total Posts: 1997
20 Sep 2015 04:14 PM
Since you are using this in a gui, im assuming you are using a localscript, so you can use game.Players.LocalPlayer. If not, then make player = the directory that will lead you to the player.
Report Abuse
Xarkos is not online. Xarkos
Joined: 15 Jul 2015
Total Posts: 2210
20 Sep 2015 04:16 PM
function onClick(click)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if script.Parent.MouseButton1Click:connect(function() then
game:GetService("TeleportService"):Teleport(299047057, player)
end
end


Patience is key 🔐
Report Abuse
Darkenus is not online. Darkenus
Joined: 17 Jul 2014
Total Posts: 1997
20 Sep 2015 04:17 PM
And what is "hit.Parent", more specifically, what is "hit"?
Report Abuse
Xarkos is not online. Xarkos
Joined: 15 Jul 2015
Total Posts: 2210
20 Sep 2015 04:18 PM
function onClick(click)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if script.Parent.MouseButton1Click:connect(function() then
game:GetService("TeleportService"):Teleport(299047057, player)
end
end

script.Parent.MouseButton1Click:connect(onClick)


i'm using a regular script

Patience is key 🔐
Report Abuse
Xarkos is not online. Xarkos
Joined: 15 Jul 2015
Total Posts: 2210
20 Sep 2015 04:20 PM
oops sorry it was actually supposed to be click.Parent.

i was just browsing the wiki :P


function onClick(click)
local player = game.Players:GetPlayerFromCharacter(click.Parent)
if script.Parent.MouseButton1Click:connect(function() then
game:GetService("TeleportService"):Teleport(299047057, player)
end
end

script.Parent.MouseButton1Click:connect(onClick)

Patience is key 🔐
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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