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: TextButton Help

Previous Thread :: Next Thread 
Cizox is not online. 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 is not online. 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 is not online. 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 is not online. zakarq
Joined: 10 Oct 2010
Total Posts: 883
18 Nov 2013 11:21 PM
script.Parent.MouseButton1Down:connect(function()
Report Abuse
LetUsGame is not online. 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 is not online. 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 is not online. 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
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