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

Why does my remote event not fire?

My code is this, for the client:

game.ReplicatedStorage.Classes.Say.OnClientEvent:Connect(function(msg, from, inclass) -- I hope this works... - Toby
	for i = 1, #inclass do
		if i == game.Players.LocalPlayer.Name then
			local gui = game.ReplicatedStorage.InClass:Clone()
			gui.Frame.Message.Text = msg
			gui.Frame.From.Text = from
			gui.Parent = game.Players.LocalPlayer.PlayerGui 
			wait(3)
			gui:Destroy()
		end
	end
end)

And to fire, from the server, we do this:

local playerTable = {player.Name}
game.ReplicatedStorage.Classes.Say:FireAllClients("Secret society doesn't work!", "Server Message!", playerTable)
print(player.Name)
print("This place hasn't been made!")

The prints, on the server script, fires. But the Gui doesn't pop up, and worse of all, there are no errors...

Thanks for reading this, I really hope that you can help me. - Toby

1 comment

0

For client, Change "if i == game.Player.LocalPlayer.Name then" to "if inclass[i] == game.Players.LocalPlayer.Name then"

2 answers

uh i think these

local playerTable = {player.Name}
repeat
wait(0.2)
game.ReplicatedStorage.Classes.Say:FireServer("Secret society doesn't work!", "Server Message!", playerTable)
until game.ReplicatedStorage.Classes.Say:FireServer("Secret society doesn't work!", "Server Message!", playerTable)

1 comment

0

This just made the prints, on server script, not print... : (

I found out that "i", on the local script, is a number, not a name. And I edited LocalPlayer.PlayerGui, to something else. So my local script should look like this:

game.ReplicatedStorage.Classes.Say.OnClientEvent:Connect(function(msg, from, inclass) -- I hope this works... - Toby
	for i = 1, #inclass do
		if inclass[i] == game.Players.LocalPlayer.Name then
			local gui = game.ReplicatedStorage.InClass:Clone()
			gui.Frame.Message.Text = msg
			gui.Frame.From.Text = from
			local localplayerName = game.Players.LocalPlayer.Name
			gui.Parent = game.Players:FindFirstChild(localplayerName).PlayerGui
			wait(3)
			gui:Destroy()
		end
	end
end)

Thanks for reading this. - Toby

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