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

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

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 ?

3 comments

0

Is filtering enabled on?

0

The server cannot access a player's PlayerGui, so the local script would have to send the script the text.

0

How would i send the script the text with the Localscirpt ?

1 answer

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)

1 comment

0

It still doesent change the value for some reason

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