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

Is it possible to edit all players gui without remote events?

Asked by 5 years ago

Hey developers, Is it possible to change all the players GUI in a server script without using the remote event feature?

I don't like to use remote events because the scripts get very messy and I will like everything to run in one script...

This what I got at the moment, any help?

wait(1)
game:WaitForChild("Players")
for _, players in pairs(game.Players:GetPlayers()) do
    if players:FindFirstChild("PlayerGui") then
        players.PlayerGui.ChooseName.Enabled = true
    end
end

Error: ChooseName is not a valid member of PlayerGui

0
If I am not wrong you cant access players GUI through server script. So I think you have to use remotes TOP_SECRE 28 — 5y
0
incorrect. GamingZacharyC 152 — 5y
0
If incorrect how would I do it? retrobricks 162 — 5y
0
not you, the first commenter GamingZacharyC 152 — 5y
View all comments (3 more)
0
And how is it incorrect? TOP_SECRE 28 — 5y
0
You can do your tricks to check when potential remote can be fired but you cant access players gui via server script. TOP_SECRE 28 — 5y
0
Still i dont see why would you use the values instead of remotes since with the values it ill be even messier. TOP_SECRE 28 — 5y

1 answer

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

EDIT: I HATE ADS!!!!!!!!

You might have to put everything into two or more scripts, because it just won't work in one (well, it might). It is a little messy. I say instead of using Events or RemoteEvents, use Values and the .changed function trigger. Like so:

This is for something like a rounds game with two teams:

Import these lines of code in the Command Prompt (Note that you can do any value type or name you want):

local sValue = Instance.new("BoolValue", game.ServerStorage) -- This is the Value for Server-Side scripts to access. sValue.Name = "Team1Won"

local lValue = Instance.new("BoolValue", game.ReplicatedStorage) -- This is the value for Client-Side Scripts to access. lValue.Name = "Team1Won"

local sValue2 = Instance.new("BoolValue", game.ServerStorage) -- This is the Value for Server-Side scripts to access. sValue.Name = "GameInProgress"

local lValue2 = Instance.new("BoolValue", game.ReplicatedStorage) -- This is the value for Client-Side Scripts to access. lValue.Name = "GameInProgress"

Whenever you want to say that "Team 1 won the game!", you can just set this value to true.

However, we need to do something about the fact that team 1 won/lost.

Inside the player's GUI, (via StarterGUI) we need to make changes. You can add whatever suits you from here, or change the scripts to your needs.

For Client-Side Scripts :

local lv1 = game.ReplicatedStorage:FindFirstChild(" "--[[Whatever your name was]])
local lv2 = game.ReplicatedStorage:FindFirstChild(" "--[[Whatever your name was]])

lv2.Changed:Connect(function(property)
    if lv2.Value = false then --Whatever value you want, really
        if lv1 = true then
            -- Add your own code for Team One's loss
        end

        if lv2 = true then
            --Add your own code for Team One's viscory
        end
    end
end)

For Server-Side Scripts :

local sv1 = game.ServerStorage:FindFirstChild(" "--[[Whatever your name was]])
local sv2 = game.ServerStorage:FindFirstChild(" "--[[Whatever your name was]])

sv2.Changed:Connect(function(property)
    if sv2.Value = false then --Whatever value you want, really
        if sv1 = true then
            -- Add your own code for Team One's loss
        end

        if sv2 = true then
            --Add your own code for Team One's viscory
        end
    end
end)
Ad

Answer this question