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: Script working in solo mode but not actual server?

Previous Thread :: Next Thread 
Krimulous is not online. Krimulous
Joined: 17 Mar 2011
Total Posts: 7993
28 Jul 2014 03:59 PM
I finished a script that lets you input a name into a textbox and then puts that into a billboard GUI, and it worked fine in solo mode.

But in an actual server, the script doesn't work. D:

In case you need to examine the script:
player = script.Parent.Parent.Parent.Parent.Parent
character = player.Character

script.Parent.FocusLost:connect(function()
local bg = Instance.new("BillboardGui")
bg.Parent = character.Head
bg.Size = UDim2.new(1, 0, 1, 0)
bg.StudsOffset = Vector3.new(0, 2, 0)
local frame = Instance.new("Frame")
frame.Parent = bg
frame.Size = UDim2.new(1, 0, 1, 0)
frame.BackgroundTransparency = 1
local text = Instance.new("TextLabel")
text.Parent = frame
text.Position = UDim2.new(0.25, 0, 0.25, 0)
text.Size = UDim2.new(0.5, 0, 0.5, 0)
text.Text = script.Parent.Text
text.BackgroundTransparency = 1
text.TextColor3 = Color3.new(1, 1, 1)
text.Font = "ArialBold"
text.FontSize = "Size24"
end)


Anyone have any suggestions or quick fixes for this problem?
Report Abuse
Krimulous is not online. Krimulous
Joined: 17 Mar 2011
Total Posts: 7993
28 Jul 2014 04:05 PM
b
bu
bum
bump
:>

The inner machinations of my mind are an enigma
Report Abuse
Krimulous is not online. Krimulous
Joined: 17 Mar 2011
Total Posts: 7993
28 Jul 2014 04:11 PM
: - (

The inner machinations of my mind are an enigma
Report Abuse
Krimulous is not online. Krimulous
Joined: 17 Mar 2011
Total Posts: 7993
28 Jul 2014 04:28 PM
frowny face : - (

The inner machinations of my mind are an enigma
Report Abuse
moontj11 is not online. moontj11
Joined: 02 Jul 2011
Total Posts: 8
28 Jul 2014 04:38 PM
Bump 4 poor krim

:-(
Report Abuse
TypicalSusie is not online. TypicalSusie
Joined: 24 Nov 2011
Total Posts: 46
28 Jul 2014 04:39 PM
bump for poor krim
Report Abuse
blackybae is not online. blackybae
Joined: 10 Jun 2011
Total Posts: 145
28 Jul 2014 04:43 PM
bump for poor krim
Report Abuse
Scriptury is not online. Scriptury
Joined: 21 Aug 2013
Total Posts: 220
28 Jul 2014 04:46 PM
I predict that this is in a normal script.
What you have to understand is that in solo mode, normal scripts can use some of the events that localscripts can use, but on an actual server they can't. One of these events are FocusLost.
You need to put this code in a localscript, and put the localscript in a suitable place. However this may mess up with multiple users.
The other alternative is to make a button that you can click to submit text, rather than using FocusLost.
I hope this helped. I too have had a lot of problems with solo mode too.
Report Abuse
dansk is not online. dansk
Joined: 24 Dec 2008
Total Posts: 548
28 Jul 2014 05:02 PM
If it works in the solo mode but not in the server, its because sometimes the scripts dont detect the variables once it enters in game. You can either check what the problem is in the output and fix it yourself or replace this with the variables part.

local player = game.Players:FindFirstChild(script.Parent.Parent.Parent.Parent.Parent)
local character = game.Workspace:FindFirstChild(player.Name)

While not player and character do
player = game.Players:FindFirstChild(script.Parent.Parent.Parent.Parent.Parent)
character = game.Workspace:FindFirstChild(player.Name)
wait()
end


What this does is that it constantly checks for player and character until they fully load.
Report Abuse
Scriptury is not online. Scriptury
Joined: 21 Aug 2013
Total Posts: 220
29 Jul 2014 04:53 AM
To do the button method, you need to first create a submit button next to the text field.
Then you need to attach the MouseButton1Click event to that submit button so when it is clicked, the desired result is given, much like loosing the focus from the text field.
So it would look something like this in your script:

player = script.Parent.Parent.Parent.Parent.Parent
character = repeat wait() until player.Character

script.Parent.Parent.Submit.MouseButton1Click:connect(function()
local bg = Instance.new("BillboardGui")
bg.Parent = character.Head
bg.Size = UDim2.new(1, 0, 1, 0)
bg.StudsOffset = Vector3.new(0, 2, 0)
local frame = Instance.new("Frame")
frame.Parent = bg
frame.Size = UDim2.new(1, 0, 1, 0)
frame.BackgroundTransparency = 1
local text = Instance.new("TextLabel")
text.Parent = frame
text.Position = UDim2.new(0.25, 0, 0.25, 0)
text.Size = UDim2.new(0.5, 0, 0.5, 0)
text.Text = script.Parent.Text
text.BackgroundTransparency = 1
text.TextColor3 = Color3.new(1, 1, 1)
text.Font = "ArialBold"
text.FontSize = "Size24"
end)

However a much easier solution would be for you to just change the whole script from a normal script to a localscript as localscripts have access to FocusLost.
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