I'm making a script to where an npc is animated and once you go into a designated area then the npc will change animations and talk(animated gui text label on screen) and I have two Local scripts.
LocalScript(the gui local script)
local remoteEvent = game.ReplicatedStorage:WaitForChild("RemoteEvent")
local textLabel = script.Parent
local typingSpeed = 0.1
local n = 0
local function playTypeSound()
local soundId = "rbxassetid://9120299407"
local sound = Instance.new("Sound")
sound.SoundId = soundId
sound.Parent = textLabel
sound:Play()
end
local function typewriterAnimation(text)
for i = 1, #text do
textLabel.Text = string.sub(text, 1, i)
if n < 5 then
playTypeSound()
end
wait(typingSpeed)
end
n = n + 1
if n == 4 then
typingSpeed = 0.4
end
end
remoteEvent.OnClientEvent:Connect(function(text)
typewriterAnimation(text)
end)
** You are now Level 8! **