How could one make a typewriter effect show up on all clients

  1. What do you want to achieve? Keep it simple and clear!

I want to make my typewriter module appear to all clients

  1. What is the issue? Include screenshots / videos if possible!

It’s sort of glitched, i can’t get it to show on every client, and when i did, only one letter showed up and the text was glitching out

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

I have tried using for i,v in players, and i couldnt find anything about this topic

local module = {}

local dial



coroutine.wrap(function()

game.Players.PlayerAdded:Connect(function(v)
		dial = Instance.new("ScreenGui")
		dial.Parent = v.PlayerGui
		dial.Name = "dial"
end)
end)()
function module.Dialouge(text, time,rotationspeed, soundid,color : Color3, color2 : Color3)
	
	
	
		if not soundid then soundid = "rbxassetid://9066167010"end
			if not time then time = 0.03 end
			if not text then text = "hi" end
			if not rotationspeed then rotationspeed = 2 end
			
	
	
	
	
		
	
	local soundid = tonumber(soundid)
	for i,v in pairs(game.Players:GetPlayers()) do

			local text2 = script.TextLabel:Clone()
			text2.Parent = v.PlayerGui:WaitForChild("dial")
			
		
	end
if color then
		for i,v in pairs(game.Players:GetPlayers()) do
		
			v.PlayerGui:WaitForChild("dial"):WaitForChild("TextLabel").UIGradient.Color = ColorSequence.new({
					ColorSequenceKeypoint.new(0, color),
					ColorSequenceKeypoint.new(1, color2)

				})
			end
		end
	

		local DEGREES_OF_ROTATION = 4
		coroutine.wrap(function()
			game:GetService("RunService").Heartbeat:Connect(function()
				for i,v in pairs(game.Players:GetPlayers()) do
				
				v.PlayerGui:WaitForChild("dial"):WaitForChild("TextLabel").Rotation = math.sin(tick()*rotationspeed) * DEGREES_OF_ROTATION
					

				end
				
			end)
		end)()
	
		
		
	
	for i = 1,#tostring(text) do
			for i,v in pairs(game.Players:GetPlayers()) do
			
			v.PlayerGui:WaitForChild("dial"):WaitForChild("TextLabel").Text = string.sub(tostring(text),1,i)
				
				
			end
		
		local e = Instance.new("Sound", game.SoundService)
		e.SoundId = "rbxassetid://"..soundid
		e:Play()
		wait(time)
	e.Name = "TYPEWRITERSOUND"
	end
	

end

function module.disable()
	for i,v in pairs(game:GetDescendants()) do
		if v.Name == "dial" and v:IsA("ScreenGui") then
			v.Enabled = false
		end
	end
end

return module

This is the version that only works on one player:

local module = {}

local dial
local text2 = script.TextLabel:Clone()


coroutine.wrap(function()

game.Players.PlayerAdded:Connect(function(v)
		dial = Instance.new("ScreenGui")
		dial.Parent = v.PlayerGui
		dial.Name = "dial"
end)
end)()
function module.Dialouge(text, time,rotationspeed, soundid,color : Color3, color2 : Color3)
	
	for i,v in pairs(game.Players:GetPlayers()) do
		dial = Instance.new("ScreenGui")
		dial.Parent = v.PlayerGui
		dial.Name = "dial"
	end
	
		if not soundid then soundid = "rbxassetid://9066167010"end
			if not time then time = 0.03 end
			if not text then text = "hi" end
			if not rotationspeed then rotationspeed = 2 end
			
	
		text2.Text = text
		if color then
		text2.UIGradient.Color = ColorSequence.new({
			ColorSequenceKeypoint.new(0, color),
			ColorSequenceKeypoint.new(1, color2)
			
		})
		end
		
	
	local soundid = tonumber(soundid)
	

		text2.Parent = dial
		local DEGREES_OF_ROTATION = 4
		coroutine.wrap(function()
			game:GetService("RunService").Heartbeat:Connect(function()
				text2.Rotation = math.sin(tick()*rotationspeed) * DEGREES_OF_ROTATION
			end)
		end)()
	
		
		
	
	for i = 1,#tostring(text) do
		text2.Text = string.sub(tostring(text),1,i)
		local e = Instance.new("Sound", game.SoundService)
		e.SoundId = "rbxassetid://"..soundid
		e:Play()
		wait(time)
	e.Name = "TYPEWRITERSOUND"
	end
	

end
function module.disable()
	for i,v in pairs(game:GetDescendants()) do
		if v.Name == "dial" and v:IsA("ScreenGui") then
			v.Enabled = false
		end
	end
end
return module
1 Like

You’re doing this on the server, not the client. Just have a ClientScript require() the module to make it client-sided.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.