Ok so I changed the damage script to this and it worked except the screen stuff doesn’t go away even after the health goes above 30 for some reason and the speed is still 3 but it does slow down when damaged. And for the sprinting script, it stays 30 when I hold it but it doesn’t go back to 10 after I am done holding ctrl
local player = game.Players.LocalPlayer
local blurEffect = game.Lighting.Blur
local colorCorrectionEffect = game.Lighting.ColorCorrection
local sound = workspace.Heartbeatsound
local isPlayerDead = false
local Image = player.PlayerGui.Damage2.ImageLabel
local Sprint = game.StarterGui.ReadMe
local UIS = game:GetService("UserInputService")
local Humanoid = player.Character.Humanoid
-- your updateEffectsFunction would be like
local function updateEffects()
if isPlayerDead then return end
if player.Character.Humanoid.Health < 30 then
blurEffect.Size = 10
colorCorrectionEffect.Brightness = -0.1
colorCorrectionEffect.TintColor = Color3.new(1, 0.537255, 0.537255)
sound:Play()
player.Character.Humanoid.WalkSpeed = 3
Image.Visible = true
Sprint.Disabled = true
else
blurEffect.Size = 0
colorCorrectionEffect.TintColor = Color3.new(1, 1, 1)
sound:Stop()
player.Character.Humanoid.WalkSpeed = UIS:IsKeyDown(Enum.KeyCode.LeftControl) and 30 or 10
Image.Visible = false
Sprint.Disabled = false
end
end
local lastHealth = Humanoid.Health
Humanoid.HealthChanged:Connect(function(health)
if health < lastHealth then
updateEffects()
end
lastHealth = health -- save for the next change
end)
I am kinda confused on where I out the input ending function in the sprinting script because this is what it looks like rn
local UIS = game:GetService('UserInputService')
local Player = game.Players.LocalPlayer
local Character = Player.Character
local Humanoid = Player.Character.Humanoid
UIS.InputEnded:connect(function(input)
if input.KeyCode == Enum.KeyCode.LeftControl and Humanoid.Health >= 30 then
Character.Humanoid.WalkSpeed = 30
local Anim = Instance.new('Animation')
Anim.AnimationId = 'Id'
PlayAnim = Character.Humanoid:LoadAnimation(Anim)
PlayAnim:Play()
end
end)
UIS.InputEnded:connect(function(input)
if input.KeyCode == Enum.KeyCode.LeftControl and Humanoid.Health >= 30 then
Character.Humanoid.WalkSpeed = 10
PlayAnim:Stop()
end
end)
But the running not ending problem, by this last script you showed, i dont know why it happens. It should work. Make sure that there arent any bugs in the output yet.
Ah, the output says that the damage script has an error at line 12 about that Humanoid.Health thing, of is this the version you are editing or a copy in the workspace?
Also, i got it, the character is not loading the run animation on the Running script (maybe it is somewhere else, i dont know if you are seeing your anim) because instead of only the string “Id” at
Anim.AnimationId = 'Id'
You should have and actual anim id. I thought you were already replacing that for an actual anim id, that should look more like “rbxassetid://00000000” < number of the id here
Sinse this id you are using is not valid and you are using an deprecated version on track creation, it is givin that “there is no animation to stop” error.
You can try to delete everything there related to animation at this script and see if the other things are working…
I removed everything relating to the animation and it still didn’t work
local UIS = game:GetService('UserInputService')
local Player = game.Players.LocalPlayer
local Character = Player.Character
local Humanoid = Player.Character.Humanoid
UIS.InputEnded:connect(function(input)
if input.KeyCode == Enum.KeyCode.LeftControl and Humanoid.Health >= 30 then
Character.Humanoid.WalkSpeed = 30
end
end)
UIS.InputEnded:connect(function(input)
if input.KeyCode == Enum.KeyCode.LeftControl and Humanoid.Health >= 30 then
Character.Humanoid.WalkSpeed = 10
end
end)
I think it could be an issue with the input keycode itself? idk
local UIS = game:GetService('UserInputService')
local Player = game.Players.LocalPlayer
local Character = Player.Character
local Humanoid = Player.Character.Humanoid
UIS.InputBegan:connect(function(input)--When a player has pressed LeftShift it will play the animation and it will set the normal walking speed (16) to 35.
if input.KeyCode == Enum.KeyCode.LeftControl and Humanoid.Health >= 30 then
Character.Humanoid.WalkSpeed = 30
end
end)
UIS.InputEnded:connect(function(input)
print(Humanoid.Health >= 30)
if input.KeyCode == Enum.KeyCode.LeftControl and Humanoid.Health >= 30 then
Character.Humanoid.WalkSpeed = 10
end
end)
i saw the problem now, you changed your inputBegan to ended also now, you must have one of each. Copy this script and it might work. Im leaving here now, these errors would be easy if you knew even a little about scripting, is not nice to just keep telling you what to do, you have to learn some scripting.
Ok everything works as intended now! Thank you so soo much! I am very sorry if I annoyed you by asking too many questions but it’s because I’m still a beginner scripter and this game is gonna be private for friends anyway. But again thank you so so much for helping me!