Hi there!
I know we talked in the chat a bit, but I don't really think you understand what local scripts and server scripts can do in filtering enabled.
Your original issue was that the server was not able to see the items in PlayerGui. With Filtering-enabled, scripts don't really look too much into the player, so they don't see the different GUIs they have, weapons they have, etc.
I recommended that you make your script a local script and have it fire the local script. I failed to tell you that you should really only put the GUI-Editing parts into the local script as local scripts can't really change values all that well. Any value a local-script changes is only seen on the client side, so it's not even noticed by the server.
I'll delve more into this, explain what went wrong, and then help you compose a new script.
LocalScripts vs ServerScripts with FilteringEnabled
I'm sure you may already know this, but it never hurts to recap right? A LocalScript is a script specifically designed for the client-side ( player's computer/ player's P-O-V). A server script is specifically designed for the server-side (what's actually going on in-game/game's P-O-V). Anything you do with a LocalScript is going to be seen by the player and only by the player. Anything you do with a ServerScript is going to be seen by all the players. For instance, with a LocalScript, you could change a Frame's position. This is only seen by the one player. With a ServerScript, you could change the player's health. This is going to be seen by all of the players. With a LocalScript, sometimes you'll run into issues where you need a change to be seen by all players. That's why we have RemoteEvents. Now I don't know a bunch about RemoteFunctions, BindableEvents, and BindableFunctions. Anything remote is considered talking between the client-side and server-side. Anything bindable (I'm pretty confident on this but double check) is talking between either the client-side to client-side or server-side to server-side.
What went wrong
With serverside, they're not all to concern about what's happening for every player. So they're not going to see anything stored into the player's PlayerGui or Backpack. They're only really acknowledging those in case they are supposed to insert something into them. That's more than likely why your ServerScript is having issues changing your GUI around. (It's also important to note that it's not really a ServerScripts job to change GUIs. I'd leave that to the LocalScripts.)
I also noticed that you're trying to change a leaderstat's value with a LocalScript, which I blindly suggested. Jumping back to my LocalScripts vs ServerScripts, only the player is going to see your money change. The server isn't going to see it, nor will the other players. Assuming this wasn't your intention, I would suggest making this part happen in the ServerScript.
Also, just to mention; you used the wrong fire event in your server script, you also neglected to tell where to fire. When you're trying to tell the client something, you're going to want to fire the client and specify which client you're trying to fire at, followed by your excess arguments. If you're firing the server, you really just fire the server and put whatever arguments you want.
How to fix
Local Script
local re = game:GetService("ReplicatedStorage"):WaitForChild("Cash")
local loopLength = 10
player.leaderstats["Drachma"].Changed:Connect(function(cash)
player.PlayerGui.Cash.amt.Text = cash
end)
repeat wait(loopLength)
re:FireServer(game.Players.LocalPlayer)
until script.Parent == nil
Server Script
local re = game:GetService("ReplicatedStorage"):WaitForChild("Cash")
re.OnServerEvent:connect(function(player)
local drachma = player:WaitForChild("leaderstats"):WaitForChild("Drachma")
if player:GetRankInGroup(4101121) >= 1 then
drachma.Value = drachma.Value + 100
elseif player:GetRankInGroup(4101121) == 0 thn
drachma.Value = drachma.Value + 10
end
end)
3 comments
ok someone help please
So you make an infinate loop each time the Cash remote event is fired?
It would only be fired once for each player since it fires when they join.