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

Remote Event isn't working on separate function?

Asked by 8 years ago

So I have to change my 'StatusGui' multiple times, as I can't change gui's whilst Filtering Enabled is true, I'm using multiple functions to fire the same event. First of all is firing the same Remote Eventagain possible? Keep in mind that I'm using a module script (if that changes anything) and I'm using another script to run the functions althought when the Gui is changed into server loaded there is no function for it. I've tried to do it like this:

Module Script :

local changeStatus = game.ReplicatedStorage.Events.ChangeStatus
changeStatus:FireAllClients('Server Has Loaded...')

module.WaitForPlayers = function(minPlayers)
    numPlayers = serverStorage.ServerValues.NumPlayers
    while numPlayers.Value < minPlayers do
        wait()
        changeStatus:FireAllClients('There needs to be atleast ' .. tostring(minPlayers) .. ' players.')
        -- statusValue.Value = 'There needs to be atleast ' .. tostring(minPlayers) .. ' players.'
    end
end

**Local Script : **


local replicatedStorage = game:GetService('ReplicatedStorage') local serverStorage = game:GetService('ServerStorage') local player = script.Parent.Parent.Parent -- local statusValue = replicatedStorage.StatusValue I currently don't need this because of FE. local statusLabel = player.PlayerGui:WaitForChild('StatusGui').StatusFrame.StatusLabel local changeStatus = game.ReplicatedStorage.Events.ChangeStatus changeStatus.OnClientEvent:connect(function(text) statusLabel.Text = tostring(text) end)
0
Do you ever call the WaitForPlayers function? M39a9am3R 3210 — 8y
0
I'll second that; you don't appear to actually call your WaitForPlayers function. You should also consider using WaitForChild, even for children in ReplicatedStorage which should already be replicated by the time the script is run. It's good practice. User#6546 35 — 8y
0
I've made another function on top of this, it uses the :IsLoaded() method on the Data Model. So I'm not using 'WaitForChild' because I already optimized my game so I don't have to. Either way I'll try using it. LifeInDevelopment 364 — 8y
0
You still didn't answer our question. User#6546 35 — 8y
View all comments (2 more)
0
Wait For Child isn't the problem. I know this because it has worked when I call the event to say 'Server Loaded', so it must've loaded already LifeInDevelopment 364 — 8y
0
^ The gui said server loaded btw. LifeInDevelopment 364 — 8y

Answer this question