Cizox
|
  |
| Joined: 25 Dec 2009 |
| Total Posts: 42220 |
|
|
| 18 Nov 2013 10:27 PM |
I have a LocalScript that when a player clicks on a TextButton, it checks if the BoolValue they have(Which they do have, so BoolValue isn't the problem) is true, and then teleports them to the place specified.
playerTeleport = script.Parent.Parent.Parent.Parent.Parent
script.Parent.MouseButton1Down:connect(function(hit) local bool = hit.Parent:findFirstChild("BoolValue") if (bool.Value == true) then playerTeleport.Character.Torso.CFrame = CFrame.new(109, 5.5, 12) end end)
OUTPUT:
23:19:37.019 - Players.Player1.PlayerGui.Menu.MenuFrame.LevelTwo.TeleportS:4: attempt to index local 'hit' (a number value) 23:19:37.022 - Script 'Players.Player1.PlayerGui.Menu.MenuFrame.LevelTwo.TeleportS', Line 4 23:19:37.025 - stack end
Any help? |
|
|
| Report Abuse |
|
|
LetUsGame
|
  |
| Joined: 09 Nov 2013 |
| Total Posts: 199 |
|
|
| 18 Nov 2013 10:49 PM |
hit isn't the player. It's a number.
The MouseButton1Down event returns 2 numbers, the position of the mouse when the player clicks the button. |
|
|
| Report Abuse |
|
|
Cizox
|
  |
| Joined: 25 Dec 2009 |
| Total Posts: 42220 |
|
|
| 18 Nov 2013 11:02 PM |
So local bool would be:
"local bool = game.Workspace.LocalPlayer"? |
|
|
| Report Abuse |
|
|
zakarq
|
  |
| Joined: 10 Oct 2010 |
| Total Posts: 883 |
|
|
| 18 Nov 2013 11:21 PM |
| script.Parent.MouseButton1Down:connect(function() |
|
|
| Report Abuse |
|
|
LetUsGame
|
  |
| Joined: 09 Nov 2013 |
| Total Posts: 199 |
|
|
| 18 Nov 2013 11:26 PM |
'So local bool would be:
"local bool = game.Workspace.LocalPlayer"?'
local bool = game.Players.LocalPlayer:FindFirstChild("BoolValue") |
|
|
| Report Abuse |
|
|
REM25
|
  |
| Joined: 28 Feb 2010 |
| Total Posts: 3154 |
|
|
| 19 Nov 2013 12:38 AM |
| wait where did you get playerteleport? Is that like an event or a method or something? |
|
|
| Report Abuse |
|
|
REM25
|
  |
| Joined: 28 Feb 2010 |
| Total Posts: 3154 |
|
|
| 19 Nov 2013 12:39 AM |
| wait lol I didnt see the top line xD Nvm folks! :3 |
|
|
| Report Abuse |
|
|