Fuction not starting on RemoteEvent

I am trying to typewrite text into a TextLabel but when the RemoteEvent fires, it doesn’t work and there are no errors in output. When I change this function to being triggered by a TextButton, it works on the third to sixth click. I think this means the typewriter’s ModuleScript from ReplicatedStorage is not loading in fast enough, and if that’s the issue, how can I make it load more quickly?

LocalScript
-- Roblox services
local rep = game:GetService("ReplicatedStorage")

-- Require module
local TypeWriter = require(rep:WaitForChild("TypeWriter"))

TypeWriter.configure({
	delayTime = 0.05,
	extraDelayOnSpace = false
})

function beginsoon()
	print("write")
	TypeWriter.typeWrite(script.Parent, "Voting will begin shortly, please stay patient.")
end

rep.Remotes.Intermission.OnClientEvent:Connect(beginsoon)

Thanks in advance,
DaBisawesome123

Add a print statement to debug after this.

check if it prints out.

Also the module script might not be working.
Add some print statements there too.

Could you provide the source code of this “TypeWriter” module script?

1 Like

The module scripts work when i trigger it with a button and click a few times. I have a print statement in front of
TypeWriter.typeWrite(script.Parent, "Voting will begin shortly, please stay patient.") but that doesnt print.

This is the ModuleScript:

ModuleScript
local SOURCE_LOCALE = "en"

local LocalizationService = game:GetService("LocalizationService")
local Players = game:GetService("Players")

local player = Players.LocalPlayer

local translator = nil
pcall(function()
	translator = LocalizationService:GetTranslatorForPlayerAsync(player)
end)
if not translator then
	pcall(function()
		translator = LocalizationService:GetTranslatorForLocaleAsync(SOURCE_LOCALE)
	end)
end

local TypeWriter = {}

local defaultConfigurations = {
	delayTime = 0.2,
	extraDelayOnSpace = true
}

function TypeWriter.configure(configurations)
	for key, value in pairs(defaultConfigurations) do
		local newValue = configurations[key]
		if newValue ~= nil then
			defaultConfigurations[key] = newValue
		else
			warn(key .. " is not a valid configuration for TypeWriter module")
		end
	end
end

function TypeWriter.typeWrite(guiObject, text)
	guiObject.AutoLocalize = false
	guiObject.Text = ""
	local displayText = text
	if translator then
		displayText = translator:Translate(guiObject, text)
	end
	for first, last in utf8.graphemes(displayText) do
		local grapheme = string.sub(displayText, first, last)
		guiObject.Text = guiObject.Text .. grapheme
		if defaultConfigurations.extraDelayOnSpace and grapheme == " " then
			wait(defaultConfigurations.delayTime)
		end
		wait(defaultConfigurations.delayTime)
	end
end

return TypeWriter

It is off of the dev hub here: UI Animations | Documentation - Roblox Creator Hub

The client is not listening to the server invoke.

Check if you are invoking the client from the server.

I can conclude in accordance with this:

How would I check this?

OnClientEvent Fires when Server Fires the Remote to the client. The Vice Versa of .OnServerEvent()
So to do that You will have to fire the Client for the Server.

If you are firing ALL Clients in a game, then use RemoteEvent:FireAllClients() in a server script

if you are firing to a certain Client in a game, then use RemoteEvent:FireClient([Client]) in a server.

To check if you have fired a client from server, then add print statements after that piece of code.

Oh I see what you mean. This is not the issue. I’m firing everything correctly. I know this because I’m invoking a countdown on the client off of the same event. But it it makes you feel better see here:

local rep = game:GetService("ReplicatedStorage")
local rem = rep:WaitForChild("Remotes")



wait(10)
while true do
	rem.Intermission:FireAllClients()
	print("fired")
	wait(20)
	rem.VoteStart:FireAllClients()
	wait(1)--10
	rem.RoundVote:FireAllClients()
	wait(1)--10
	rem.GameStart:FireAllClients()
	wait(1)--180
end

@MrMouse2405 Do you have any idea with what the issue is?

I don’t rlly get what’s happening. Try to play again in studio, and wait 10 seconds. and see if its printing(I am refering to the server script, if it is printing then the local). If the local script is not printing then you might be having some internet problems because play test in studio acts like an actual server and a client.

I added a wait 20 before the event fires. This did fix it.