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
We use cookies to offer you a better experience. By using Roblox.com, you are agreeing to our Privacy and Cookie Policy.
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Works in Play Solo, but not online

Previous Thread :: Next Thread 
alexrocks911 is not online. alexrocks911
Joined: 14 Feb 2012
Total Posts: 11546
23 Jun 2013 05:44 PM
(Relates to my thread - http://www.roblox.com/Forum/ShowPost.aspx?PostID=102452718)

Ok, So I have this "YES" TextButton in a Frame in a GUI.

It works fine in Play Solo mode, but not in the actual online mode.

In the Studio "Play Solo" mode, the "YES" button works fine. But when I go to my place in the actual online mode, the "YES" button doesn't work. I keep clicking it, nothing happens.
In Play Solo, When I click the "YES" button, it does what it's supposed to do, teleport to a certain position in the game. (That doesn't happen in the actual online mode)


How do I fix this?
Report Abuse
alexrocks911 is not online. alexrocks911
Joined: 14 Feb 2012
Total Posts: 11546
23 Jun 2013 05:47 PM
Bump.


Need it for a game, Thanks.
Report Abuse
zakary99 is not online. zakary99
Joined: 19 Jan 2010
Total Posts: 1095
23 Jun 2013 05:47 PM
What's the code?
Report Abuse
froggodude is not online. froggodude
Joined: 22 Sep 2012
Total Posts: 1638
23 Jun 2013 05:49 PM
you might need to put the script you have into a local script if you don't already.
Report Abuse
alexrocks911 is not online. alexrocks911
Joined: 14 Feb 2012
Total Posts: 11546
23 Jun 2013 05:51 PM
@froggo, thanks, I'll be sure to try that when I get on my laptop again.
It's a normal script right now, I'll make it a LocalScript
Report Abuse
TheAmazeman is online. TheAmazeman
Joined: 24 Sep 2008
Total Posts: 1599
23 Jun 2013 05:51 PM
- ScreenGui
-- TextButton (Yes) Put the script below in here
--- Script
--Other buttons


plr = script.Parent.Parent.Parent.Parent

script.Parent.MouseButton1Click:connect(function()
char = plr.Character
torso = char.Torso
torso.CFrame = CFrame.new(game.Workspace.Base.Position) --make sure there's only 1 brick in workspace named "Base" at all times
end)

Report Abuse
alexrocks911 is not online. alexrocks911
Joined: 14 Feb 2012
Total Posts: 11546
23 Jun 2013 05:59 PM
@Zackary and TheAmazeman

My current script is:

function onClicked()
if game.Players.LocalPlayer == nil then return end
game.Players.LocalPlayer.Character.Torso.CFrame =CFrame.new(1.5, 58, -15.5)
end
script.Parent.MouseButton1Click:connect(onClicked)

The script works, but only in Play Solo. Should it be a regular script or LocalScript
Also, TheAmazeman, I know where the TextButton and script should be.
Report Abuse
TheAmazeman is online. TheAmazeman
Joined: 24 Sep 2008
Total Posts: 1599
23 Jun 2013 06:03 PM
You can't use game.Players.LocalPlayer if it's not in a local script, but the code I put will work in a regular script. Just replace

torso.CFrame = CFrame.new(game.Workspace.Base.Position)

with

torso.CFrame = CFrame.new(1.5, 58, -15.5)
Report Abuse
alexrocks911 is not online. alexrocks911
Joined: 14 Feb 2012
Total Posts: 11546
23 Jun 2013 06:04 PM
So I should make my script a LocalScript?
Report Abuse
TheAmazeman is online. TheAmazeman
Joined: 24 Sep 2008
Total Posts: 1599
23 Jun 2013 06:07 PM
Up to you, but you can have this work fine


plr = script.Parent.Parent.Parent.Parent
script.Parent.MouseButton1Click:connect(function()
char = plr.Character
torso = char.Torso
torso.CFrame = CFrame.new(1.5, 58, -15.5)
end)
Report Abuse
alexrocks911 is not online. alexrocks911
Joined: 14 Feb 2012
Total Posts: 11546
23 Jun 2013 06:08 PM
Alright, I'll try out both and see if there's any difference.


Thanks.
Report Abuse
zakary99 is not online. zakary99
Joined: 19 Jan 2010
Total Posts: 1095
26 Jun 2013 05:26 AM
@TheAmazeMan, LocalPlayer has worked for me in normal code. So that doesn't add up.
~Zak
Report Abuse
mark298 is not online. mark298
Joined: 24 Oct 2008
Total Posts: 1264
26 Jun 2013 05:29 AM
All scripts in Solo are run locally so put it in a Local Script.
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