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
|
  |
| 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
|
  |
| Joined: 23 Oct 2010 |
| Total Posts: 526 |
|
| |
|
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
|
  |
| Joined: 23 Oct 2010 |
| Total Posts: 526 |
|
|
| 28 Dec 2015 07:55 AM |
@error9999 I just tried that and nothing happened :/ |
|
|
| Report Abuse |
|
|
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
|
  |
| 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
|
  |
| 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
|
  |
| Joined: 23 Oct 2010 |
| Total Posts: 526 |
|
| |
|
harleyb09
|
  |
| Joined: 23 Oct 2010 |
| Total Posts: 526 |
|
| |
|
|
| 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
|
  |
| 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
|
  |
| Joined: 23 Oct 2010 |
| Total Posts: 526 |
|
| |
|
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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 4285 |
|
| |
|
Link5659
|
  |
| Joined: 04 Jun 2012 |
| Total Posts: 4525 |
|
| |
|
indeimaus
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 4285 |
|
| |
|
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
|
  |
| 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 |
|
|