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: What did I do wrong?

Previous Thread :: Next Thread 
harleyb09 is not online. harleyb09
Joined: 23 Oct 2010
Total Posts: 526
28 Dec 2015 07:40 AM
So for this script I wanted to click a gui called KiritoButton which would take me to a spawn location called KiritoSpawn. However it doesn't seem to work... This is a LocalScript if that helps.

Player = game.Players.LocalPlayer
Spawn = game.Workspace.KiritoSpawn
TeleportButton = script.Parent.KiritoButton
HasPressedTeleport = false

function MouseEnterTeleportButton()
TeleportButton.BackgroundColor3 = Color3.new(255,1,4)

end

function MouseLeftTeleportButton()
TeleportButton.BackgroundColor3 = Color3.new(144,144,144)

end

function TeleportPlayer()
if HasPressedTeleport == false then
Player.Character:MoveTo(Spawn.Position)
end

end

TeleportButton.MouseEnter:connect (MouseEnterTeleportButton)
TeleportButton.MouseLeave:connect (MouseLeftTeleportButton)
TeleportButton.MouseButton1Down:connect(TeleportPlayer)
Report Abuse
indeimaus is not online. indeimaus
Joined: 01 Sep 2014
Total Posts: 4285
28 Dec 2015 07:42 AM
LocalPlayer isn't a real thing, you can get it player from characters and click detectors using a function though
Report Abuse
harleyb09 is not online. harleyb09
Joined: 23 Oct 2010
Total Posts: 526
28 Dec 2015 07:48 AM
So how would I do that?
Report Abuse
error9999 is not online. error9999
Joined: 05 Sep 2009
Total Posts: 1593
28 Dec 2015 07:49 AM
Guess just the same, but player is something like script.Parent.Parent.Parent then.
Report Abuse
harleyb09 is not online. harleyb09
Joined: 23 Oct 2010
Total Posts: 526
28 Dec 2015 07:55 AM
@error9999
I just tried that and nothing happened :/
Report Abuse
brados123 is not online. brados123
Joined: 24 Nov 2012
Total Posts: 2143
28 Dec 2015 07:59 AM
he said he is using a local script.

use game.Players.Localplayer to get the player.
Report Abuse
harleyb09 is not online. harleyb09
Joined: 23 Oct 2010
Total Posts: 526
28 Dec 2015 08:04 AM
Ok, so it still didn't work so what do I do?
Report Abuse
error9999 is not online. error9999
Joined: 05 Sep 2009
Total Posts: 1593
28 Dec 2015 08:05 AM
Try making a normal script of it?

and maybe teleport the player using this:

Player.Character.Torso.CFrame = Spawn.CFrame
Report Abuse
harleyb09 is not online. harleyb09
Joined: 23 Oct 2010
Total Posts: 526
28 Dec 2015 08:16 AM
Still nope :/
Report Abuse
harleyb09 is not online. harleyb09
Joined: 23 Oct 2010
Total Posts: 526
28 Dec 2015 09:00 AM
le bump
Report Abuse
HarrySnotte is not online. HarrySnotte
Joined: 27 Jun 2011
Total Posts: 2854
28 Dec 2015 09:04 AM
Does the MouseEnter thingy work? If, not you might just have forgotten to put Disabled on false L0L.
Also, I do recommend you don't use LocalPlayer... CFraming the torso would also be better than moving the character with MoveTo.
Report Abuse
harleyb09 is not online. harleyb09
Joined: 23 Oct 2010
Total Posts: 526
28 Dec 2015 09:14 AM
I'm not very good at scripting by any means, could you please show me the script with the corrections? Thanks.
Report Abuse
harleyb09 is not online. harleyb09
Joined: 23 Oct 2010
Total Posts: 526
28 Dec 2015 11:35 AM
le bump^2
Report Abuse
Link5659 is not online. Link5659
Joined: 04 Jun 2012
Total Posts: 4525
28 Dec 2015 11:53 AM
LocalPlayer is a thing and it works perfect (depending on what its your using it for/with)
Report Abuse
harleyb09 is not online. harleyb09
Joined: 23 Oct 2010
Total Posts: 526
28 Dec 2015 11:56 AM
If it works perfect then why doesn't it teleport me to the spawn?
Report Abuse
indeimaus is not online. indeimaus
Joined: 01 Sep 2014
Total Posts: 4285
28 Dec 2015 12:28 PM
local player isnt a real thing and studio gets pissy if you try it
Report Abuse
Link5659 is not online. Link5659
Joined: 04 Jun 2012
Total Posts: 4525
28 Dec 2015 12:31 PM
game.Players.LocalPlayer is a thing and it works, but studio does get whinny if you use it
Report Abuse
Link5659 is not online. Link5659
Joined: 04 Jun 2012
Total Posts: 4525
28 Dec 2015 12:31 PM
Also it is a thing, know how to google? http://wiki.roblox.com/index.php?title=API:Class/Players/LocalPlayer
Report Abuse
indeimaus is not online. indeimaus
Joined: 01 Sep 2014
Total Posts: 4285
28 Dec 2015 12:33 PM
it isn't a usable thing
Report Abuse
Link5659 is not online. Link5659
Joined: 04 Jun 2012
Total Posts: 4525
28 Dec 2015 12:33 PM
is*
Report Abuse
indeimaus is not online. indeimaus
Joined: 01 Sep 2014
Total Posts: 4285
28 Dec 2015 12:34 PM
It isn't practical.
Report Abuse
cbhusker is not online. cbhusker
Joined: 07 Feb 2011
Total Posts: 517
28 Dec 2015 12:36 PM
@indeimaus is an obvious troll, guys. calm down


print("Hello World!")
Report Abuse
harleyb09 is not online. harleyb09
Joined: 23 Oct 2010
Total Posts: 526
28 Dec 2015 12:57 PM
This is why I asked scriptinghelpers.org for help instead
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