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: GUI Scripts haven't been working

Previous Thread :: Next Thread 
onion97 is not online. onion97
Joined: 22 Jun 2008
Total Posts: 64
16 Aug 2014 06:55 PM
Hello everyone! I have been dealing with this for a while now, but it's really creating problems for me. In Studio, I will have a GUI(s) that has script in it, such as a player count, and it will work flawlessly when I test it in studio, however, when I save it and play the game, the scripts in the GUI(s) do not work. I'm not sure why this is happening, but it's really getting in the way of making my game. If anybody can explain this, I would highly appreciate it if they do so. Thanks for reading!

-- Yes the scripts do work, I have tested various scripts to do several things, and they will work perfectly fine in the test, they just don't work in the game after I publish it and play it regularly in a public server.
Report Abuse
onion97 is not online. onion97
Joined: 22 Jun 2008
Total Posts: 64
18 Aug 2014 12:57 AM
Bump - Not many views
Report Abuse
AnonyAnonymous is not online. AnonyAnonymous
Joined: 23 Jun 2013
Total Posts: 6332
18 Aug 2014 01:00 AM
Could you show us the script?, there's multiple reasons as to why this could be occurring.
Report Abuse
onion97 is not online. onion97
Joined: 22 Jun 2008
Total Posts: 64
18 Aug 2014 03:33 AM
txt = script.Parent
function updateGUI()
local players = game.Players:getPlayers()
if #players == 1 then
txt.Text = "# of players in this server: ".. #players ..""
elseif #players > 1 then
txt.Text = "# of players in this server: ".. #players .. ""
end
end

updateGUI()
game.Players.ChildAdded:connect(updateGUI)
game.Players.ChildRemoved:connect(updateGUI)

---------------------------------------------------------------------------
This is one of the scripts that works like a charm when testing, but doesn't work after being published. 0 scripts work when they're inside a GUI. Also, this script is not disabled.
Report Abuse
onion97 is not online. onion97
Joined: 22 Jun 2008
Total Posts: 64
18 Aug 2014 03:48 AM
Also, the forum filtered out the spaces in the script, so the spacing isn't the same as how it actually is.
Report Abuse
AnonyAnonymous is not online. AnonyAnonymous
Joined: 23 Jun 2013
Total Posts: 6332
18 Aug 2014 03:53 AM
Could you also describe the hierarchical order of the objects?.
Report Abuse
epicbreaker is not online. epicbreaker
Joined: 23 Apr 2011
Total Posts: 2791
18 Aug 2014 06:31 AM
txt = script.Parent
function updateGUI()
local players = game.Players.NumPlayers
txt.Text = "# of players in this server: "..players
end
Report Abuse
onion97 is not online. onion97
Joined: 22 Jun 2008
Total Posts: 64
18 Aug 2014 07:00 AM
Objects: Game > StarterGui > [ScreenGui] > [ScreenGui] > [TextLabel] > [Script]
---
Report Abuse
epicbreaker is not online. epicbreaker
Joined: 23 Apr 2011
Total Posts: 2791
18 Aug 2014 07:11 AM
Did you even try my script?
Report Abuse
onion97 is not online. onion97
Joined: 22 Jun 2008
Total Posts: 64
18 Aug 2014 08:51 AM
No it did not work, local or server.
Report Abuse
onion97 is not online. onion97
Joined: 22 Jun 2008
Total Posts: 64
18 Aug 2014 08:54 AM
Okay it's 6:53 am and I have not slept, so I'm going to sleep a little then come back to check on new posts. Goodnight everyone!
Report Abuse
blocco is not online. blocco
Joined: 14 Aug 2008
Total Posts: 29474
18 Aug 2014 09:21 AM
LocalScripts run on the client.
Scripts run on the server.

Be sure that, since your PlayerGui [del]will not[/del] [ins]should not[/ins] replicate to the server, the code must run on the client. Use LocalScripts for GUI stuff.
Report Abuse
SkeletalOrigin is not online. SkeletalOrigin
Joined: 16 Aug 2012
Total Posts: 8359
18 Aug 2014 09:27 AM
while wait() do
player = players:GetChildren()
script.Parent.Text = "No. of players: " .. tonumber(#players)
end

I found an origin, it was Skeletal.
Report Abuse
SkeletalOrigin is not online. SkeletalOrigin
Joined: 16 Aug 2012
Total Posts: 8359
18 Aug 2014 09:28 AM
while wait() do
players = game.Players:GetChildren()
script.Parent.Text = "No. of player: " .. tonumber(#players)
end

Sorry I'm also tired xD

I found an origin, it was Skeletal.
Report Abuse
onion97 is not online. onion97
Joined: 22 Jun 2008
Total Posts: 64
18 Aug 2014 10:22 PM
Thank you so much, blocco!! I did what you said, and it works perfectly! I have no idea why I didn't already think of that. Thanks so much, I have been dealing with this problem for ever lol.
Report Abuse
onion97 is not online. onion97
Joined: 22 Jun 2008
Total Posts: 64
18 Aug 2014 10:38 PM
Thank you so much, blocco!! I did what you said, and it works perfectly! I have no idea why I didn't already think of that. Thanks so much, I have been dealing with this problem for ever lol.
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