Hi, So I made a dash ability in roblox were you click R, and your avatar is supposed to dash.
The ability works just fine, but when I die, and try to use the ability again, nothing happens.
Here is my script:
local player = game.Players.LocalPlayer
local character = player.CharacterAdded:Wait()
local head = character:WaitForChild("Head")
local humanoid = character.Humanoid
local torso = character.UpperTorso
local mouse = player:GetMouse()
local target
local God = player.PlayerGui.ChooseCharacter.God
--BREAKLINE--
local function onKeyPress(actionName, userInputState, inputObject)
target = mouse.Target
if userInputState == Enum.UserInputState.Begin then
if inputObject.KeyCode.Name =="R" then
if God.Value == "Zeus" then
print("LIGHTNING DASH!")
head.CFrame = head.CFrame * CFrame.new(0,0,-50)
else
print("FAIL")
end
end
if inputObject.KeyCode.Name =="E" then
if God.Value == "Zeus" then
print("THUNDERBOLT!")
local damage = game.Workspace.Damage:Clone()
local Thunder = Instance.new("Part")
Thunder.Name = ("ThunderBolt")
local mesh = Instance.new("SpecialMesh",Thunder)
mesh.MeshId = "rbxassetid://978945957"
mesh.TextureId = "rbxassetid://978945981"
Thunder.Anchored = true
Thunder.Orientation = Vector3.new(0,0,0)
mesh.Scale = Vector3.new(5,20,15)
damage.CFrame = CFrame.new(target.Position)
damage.Parent = workspace
Thunder.CFrame = CFrame.new(target.Position)
Thunder.Parent = workspace
wait(1)
damage:Destroy()
Thunder:Destroy()
else
print("FAIL")
end
end
end
end
game:GetService("ContextActionService"):BindAction(
"keyPress",
onKeyPress,
false,
Enum.KeyCode.R,
Enum.KeyCode.E
)

4 comments
Where is it placed
Starter Player Scripts
Place that script inside the PlayerGui, scripts inside StarterPlayerScripts only run when the player firstly joins.
it worked thx so much! When I put the script in PlayerGui, it fixed a lot of my problems, thx so much!