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

I have a script that changes a Value to the text of a gui. It works in studio but not ingame why?

Asked by
Zunaxo -3
6 years ago

Local Script :

script.Parent.Changed:connect(function() game.ReplicatedStorage.gong:FireServer() end)

Server Script:

game.ReplicatedStorage.gong.OnServerEvent:connect(function(plr)
    plr.Backpack.teamo.Value = plr.PlayerGui.gang.Crew.Teamcode.Text

end)

Problem:

It works perfectly in studio but ingame it just doesent change the Value anyone got a solution ?

0
Is filtering enabled on? Creeper_Dude158 11 — 6y
0
The server cannot access a player's PlayerGui, so the local script would have to send the script the text. UgOsMiLy 1074 — 6y
0
How would i send the script the text with the Localscirpt ? Zunaxo -3 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

As you see, Filtering Enabled is blocking everything made by/stored by the client, which means if you have a Gui inside the StarterGui, that won't be available for the server.

What you can do is to save the Gui inside ServerStorage or some other server-sided place, and when a player joins copy the Gui and parent it to the Player's PlayerGui. Then the server will have access to that Gui, otherwise you can use RemoteEvents and RemoteFunctions to pass information to/from the server/client.

You can read more about RemoteEvents/Functions here

You can also have a read about filtering enabled (also called experimental mode, but off) here

Here's an example of how to copy a Gui and clone it to the player


local Players = game:GetService("Players") local RepSto = game:GetService("ReplicatedStorage") local CloneGui = RepSto:FindFirstChild("GUINAME_HERE") -- The gui to clone Players.PlayerAdded:Connect(function(newPlayer) --New player joined local newClone = CloneGui:Clone() -- Clones the Gui newClone.Parent = newPlayer.PlayerGui -- Now the Gui is available for the server end)
0
It still doesent change the value for some reason Zunaxo -3 — 6y
Ad

Answer this question