I was working on a type writer text script and I wanted to delete another script from my game after said line. Here’s the full script:
local textLabel = script.Parent.Main.TextLabel
script.Parent.Enabled = false
wait(10)
script.Parent.Enabled = true
local function typewrite(object, text)
for i = 1, string.len(text) do
object.Text = string.sub(text,1,i)
wait(0.05)
end
end
game.Workspace.Talk:Play()
typewrite(textLabel,"You ate a bean burrito and now you're here lol. Run directly at small
walls to vault over them.")
wait(0.5)
game.Workspace.Talk:Pause()
wait(5)
game.Workspace.Talk:Play()
typewrite(textLabel,"Oh, you can also triple jump in this game, interesting...")
wait(0.5)
game.Workspace.Talk:Pause()
wait(5)
game.Workspace.Talk:Play()
typewrite(textLabel,"Actually, i'm gonna make you pay for that ability, because I have to act
like an obby dev.")
game.StarterPlayer.StarterCharacterScripts.DoubleJump:Destroy()
wait(0.5)
game.Workspace.Talk:Pause()
wait(5)
game.Workspace.Talk:Play()
typewrite(textLabel,"Walk into the portal to access the obby, and please give me money")
wait(0.5)
game.Workspace.Talk:Stop()
wait(5)
script.Parent.Enabled = false
I came by this problem as well while I was working with the starterGUIfolder.
To delete that script, you have to get rid of it inside the player.
When a player respawns, Roblox clones everything inside the StarterCharacterScripts folder to the player, so you need to remove the script from the desired player.
I recommend having the script initially disabled in StarterCharacterScripts and enabling/disabling for each player when needed. That way, if a new player joins and/or the current player dies, the script is not lost.
Alright, so it doesn’t get copied over to PlayerScripts. I’m not sure why though. Here’s what the double jump script looks like:
local UserInputService = game:GetService("UserInputService")
local player = game:GetService("Players").LocalPlayer
local character = player.Character
local humanoid = character:WaitForChild("Humanoid")
local MAX_JUMPS = 3
local TIME_BETWEEN_JUMPS = 0.2
local numJumps = 0
local canJumpAgain = false
local function onStateChanged(oldState, newState)
if Enum.HumanoidStateType.Landed == newState then
numJumps = 0
canJumpAgain = false
elseif Enum.HumanoidStateType.Freefall == newState then
wait(TIME_BETWEEN_JUMPS)
canJumpAgain = true
elseif Enum.HumanoidStateType.Jumping == newState then
canJumpAgain = false
numJumps += 1
end
end
local function onJumpRequest()
if canJumpAgain and numJumps < MAX_JUMPS then
humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
end