Type Writer effect starts when tweening the gui down

I have a proximity prompt that once you click it it tweens a gui up
but i’m trying to get a cool type writer effect to go with it once the player activates it

image

script.Parent.Parent.ProximityPrompt.Triggered:Connect(function(player)
	game.ReplicatedStorage.Tween:FireClient(player)
end)

Script inside ProximityPrompt ^

image

RemoteEvent ^

image
GUI ^

(Core script below)

local Player = game.Players.LocalPlayer 
local PlayerGui = Player:WaitForChild("PlayerGui")

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Tween = ReplicatedStorage:WaitForChild("Tween")

local Frame = script.Parent

-- TypeWriter
local textLabel = script.Parent:WaitForChild("Fade"):WaitForChild("TextLabel")
local function typewrite(object,text,length)
	for i = 1,#text,1 do
		object.Text = string.sub(text,1,i)
		wait(length)
	end
end


-- Length 
local Tweenremove = 5 -- change this to how long you want the transition to take


-- Tween

Tween.OnClientEvent:Connect(function()
	Frame.Visible = true
	Frame:TweenPosition(UDim2.new(0.24, 0,0.796, 0), "In", "Quad", 0.5)
	wait(Tweenremove)
	Frame:TweenPosition(UDim2.new(0.24, 0,1.1, 0), "In", "Quad", 0.5)
	
	-- TypeWriter
	typewrite(textLabel,"Bro... You stepped on my babies head. You gave me a heart attack and I am now deceased D:",0.02) 
	
end)

(other local script below)

game.ReplicatedStorage.Tween.OnClientEvent:Connect(function()
	script.Parent.Enabled = not script.Parent.Enabled
end)

Basically it is playing the type writer effect when the gui tween goes down

3 Likes

You are calling the ‘typewrite’ function after the text-box transitions down. Here is my run-down (aka fix) of it.

Tween.OnClientEvent:Connect(function()
	Frame.Visible = true
	Frame:TweenPosition(UDim2.new(0.24, 0,0.796, 0), "In", "Quad", 0.5)
    -- TypeWriter
	typewrite(textLabel,"Bro... You stepped on my babies head. You gave me a heart attack and I am now deceased D:",0.02) 
	wait(Tweenremove)
	Frame:TweenPosition(UDim2.new(0.24, 0,1.1, 0), "In", "Quad", 0.5)
end)
2 Likes

omg I’m stupid.

Thanks for the help!

1 Like