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)