Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

What is wrong with this FE screengui script that is reporting no errors?

local script

local Player = game.Players.LocalPlayer
local remote = game.ReplicatedStorage.MG -- remoteevent
script.Parent.MouseButton1Click:connect(function()
	remote:FireServer()
end)

Serverscript

local Player = game.Players.LocalPlayer

local remote = game.ReplicatedStorage.MG

remote.OnServerEvent:connect(function()
print("screw")
    Player.PlayerGui.ScreenGui.Frame.TextLabel.Text = Player.PlayerGui.Money.Value

end)

I'm not sure whats going on, I Think I wrote the fire server part right, and I'm not getting any errors. But the text remains as "Label" instead of changing to 0...

Is it because "money" is a IntValue?

Or is it because The server isn't transferring the information back, thus its working but the client can't see it?

I have no experience in FE. and the Wiki is absolutely useless because I'm too dumb to understand it.

SO if anyone could help me, I'd be sincerely grateful.

2 comments

0

I believe that you are right in saying that it won't go to the Value because it isn't an integer. You are probably going to have to use > tonumber(Player.StarterGui.ScreenGui...) maybe that will work ?

1

If the server needs a number from a client's GUI, you'll need to send that number as an argument in the RemoteEvent. Note that servers don't have access to the content of a player's GUI.

2 answers

✓ Accepted answer

3 errors I found

You should use remote.OnServerEvent:connect(function() at line 3 at server.

Also, are you trying to make the money value the text of the label? I think you have them mixed up. Switch the money value with the text value.

Also, you seem to be changing the gui on a starter gui, inside of player (doesnt exist). Instead a player has its own PlayerGui.

Fixed line 4: Player.PlayerGui.ScreenGui.Frame.TextLabel.Text = Player.PlayerGui.Money.Value

Hope this helps

1 comment

0

It's still not fireing, even with the corrections. I changed the questions scripts to what I have now, are they correct?

local Player = game.Players.LocalPlayer
local remote = game.ReplicatedStorage.MG
remote.OnServerEvent:connect(function() -- You need to add OnServerEvent, just like you would need to do Touched if you wanted to a touched function.
    Player.StarterGui.Money.Value = Player.StarterGui.ScreenGui.Frame.TextLabel.Text -- Switch this, so Text first then value.
end) 

This discussion is preserved as it was. New answers, comments, and votes are closed.