Hey there!
I've been trying to learn how to use the Messaging Service of Roblox, I've watched a few tutorials and none of them have really helped my problem, See I'm making a global announcement GUI to test this and help me understand it more, but my module script gets nil values?
Here's my Server Script (I know its not good to use these in a GUI, but it broke even more using remotes)
local mod = require(game.ServerScriptService.Timing)
script.Parent.MouseButton1Click:Connect(function()
local messageService = game:GetService("MessagingService")
local value1 = script.Parent.Parent.dur.Text
local value2 = script.Parent.Parent.msg.Text
messageService:PublishAsync("GMessage", value2,value1)
end)
Here's the detector,
local mod = require(game.ServerScriptService.Timing)
local messageService = game:GetService("MessagingService")
messageService:SubscribeAsync("GMessage", function(message,timesent,text, Dur)
mod.GlobalMessage(text,Dur)
end)
And here's my Module Script
function module.GlobalMessage(thecurrentmesage,timetostay)
for i,v in pairs(game.Players:GetChildren()) do
local sample = game.ReplicatedStorage.MessageGui:Clone()
sample.Parent = v.PlayerGui
sample.Image.TextLabel.Text = thecurrentmesage
game.Debris:AddItem(sample, timetostay)
end
end
Now this is where things break, Any values sent to this are automatically nil? And no its not because the textbox values are local, i have remotes constantly updating them from local to serverside, This is one of them
script.Parent.Changed:Connect(function()
script.RemoteEvent:FireServer(script.Parent.Text)
print(script.Parent.Text)
end)
--Local
script.Parent.OnServerEvent:Connect(function(plr,text)
script.Parent.Parent.Parent.Text = text
print(script.Parent.Parent.Parent.Text)
warn(plr.Name.." Changed this value")
end)
--Server
Any help with this is greatly appreciated, I'll be sure to upvote and accept answers that help, Thank you!
