Profile, messages, bookmarks and preferences Typewriting effect is allowing player to use more than once

I created a typewriting effect, and i want to make it so a player is only allowed to get the typewriting effect once. But when a player resets their character, they are able to get the typewriting effect again.I tried editing the script (my knowledge in scripting is very limited) and I wasn’t able to achieve what I wanted to achieve. I don’t know where to start, could somebody help? Here is my script:

local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild(“Humanoid”)

local TriggerPart = workspace:WaitForChild(“TriggerPart”)
local Frame = script.Parent.Parent

local typewritingTriggered = {}

function AutoType(textLabel, message)
for i = 1, #message do
textLabel.Text = string.sub(message, 1, i)
task.wait(0.07)
script.Sound:Play()
end
end

TriggerPart.Touched:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player and not typewritingTriggered[player] then
typewritingTriggered[player] = true
Frame.Visible = true
Humanoid.WalkSpeed = 0
Humanoid.JumpPower = 0

	AutoType(script.Parent, "The evil dentist has gone crazy! Let's try and find a way to escape!")
	wait(#"hello hi" * 0.1)  

	Frame.Visible = false
	wait(0)  

	Humanoid.WalkSpeed = 16
	Humanoid.JumpPower = 50
end

end)

3 Likes

You can use ReplicatedFirst to do this.

1 Like

how do I do that? ````````````````

You need to put your UI in ReplicatedFirst. Like you would with a LoadGameGUI, you would instead use your UI Elements.

I would recommend trying to do it, and then if you are struggling, then you can find a tutorial on a Loading Screen and adapt it so that instead of it being a loading screen, the UI is what you would like to put there. So it only appears once.

Id rather just adjust the script though, that’ll be more convenient for me