Basicly I wanna fire the amount of numbers in the chat and for each letter it should add a second to the lengh.
I cant find anything online.
game.Players.PlayerAdded:connect(function(player) player.Chatted:Connect(function(msg) local length = string.len(msg) game.ReplicatedStorage.ChatEvent.ChatAnimation:FireClient() end) end)
Script
game.Players.PlayerAdded:connect(function(player) player.Chatted:Connect(function(msg) game.ReplicatedStorage.ChatEvent.ChatAnimation:FireClient(#msg) end) end)
LocalScript
repeat wait() until game.Players.LocalPlayer player = game.Players.LocalPlayer character = player.Character if not character then character = player.CharacterAdded:wait() end humanoid = character:WaitForChild("Humanoid") s = humanoid:LoadAnimation(game.StarterPack.OnChatAnimation.ChatAnim) game.ReplicatedStorage.ChatEvent.ChatAnimation.OnClientEvent:Connect(function(msg) s:Play(msg) end)
game.Players.PlayerAdded:connect(function(player) player.Chatted:Connect(function(msg) game.ReplicatedStorage.ChatEvent.ChatAnimation:FireClient(#msg * 0.2) -- passes in the total length of time end) end)
In the script above, you simply take the number of characters in msg
by using the # symbol. Then, multiply that by the amount of time per character.
#msg * 0.2
is 0.2 seconds per character.
Then inside your OnClientEvent:Connect(function()...
you can receive the parameter by doing this: OnClientEvent:Connect(function(time)...
.
Hope this helps.