Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
Kitorari 266 Moderation Voter
7 years ago
Edited 7 years ago

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.

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 ? XtremeSpy 80 — 7y
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. chess123mate 5873 — 7y

2 answers

Log in to vote
1
Answered by 7 years ago
Edited 7 years ago

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

0
It's still not fireing, even with the corrections. I changed the questions scripts to what I have now, are they correct? Kitorari 266 — 7y
Ad
Log in to vote
1
Answered by 7 years ago
Edited 7 years ago
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) 

Answer this question