i have no idea how to make a heal script i have a script
local healAmount = 2.2 | |
---|---|
local currenthp = hum.Health | |
local newhp = currenthp + healAmount |
i have no idea how to make a heal script i have a script
local healAmount = 2.2 | |
---|---|
local currenthp = hum.Health | |
local newhp = currenthp + healAmount |
please be more specific about your request. and what you have right now would not work
i want to make a heal script and my script is not working
Roblox supplies you with a default one. If you want to make your own, Here’s a link which can help:
StarterCharacterScripts
i want to make when player press a key they heal
local HealAmount = 10
while Humanoid.Health <= 100 do
Humanoid.Health += HealAmount
end
That requires UserInputService and probably a remoteEvent. All you have to do is detect when the player presses the key down, they heal until it ends. You probably need to fire it to the server because of Filtering Enabled.
local UIS = game:GetService("UserInputService")
UIS.InputBegan:Connect(function(key, GP)
if key.KeyCode == Enum.KeyCode.H and not GP then
print("Healing!")
--Your code
end
end)
UIS.InputEnded:Connect(function(key, GP)
if key.KeyCode == Enum.KeyCode.H and not GP then
print("Stopped!")
--Your code
end
end)
will this script work? .5)
enemy.Humanoid:TakeDamage(1.5)
hum.Health += newhp
No, it doesn’t repeat itself. It would only work once.
enemy.Humanoid:TakeDamage(1.5)
CanHeal = script.Parent.CanHeal.Value
local Cooldown = 0.5
while CanHeal == true do
hum.Health += newhp
wait(Cooldown)
end
wdym?
the line takedamage will trigger the next line?
no i want to make the world bloodsuck that i damage him and i heal
ServerScriptService
local db = false
game.ReplicatedStorage.HealStart.OnServerEvent:Connect(function(player)
if not db then
db = true
player.Character:WaitForChild("Humanoid"):TakeDamage(95)
end
player.Character:WaitForChild("Health").Disabled = false
end)
game.ReplicatedStorage.StopHealing.OnServerEvent:Connect(function(player)
player.Character:WaitForChild("Health").Disabled = true
end)
StarterCharacterScripts
local UIS = game:GetService("UserInputService")
UIS.InputBegan:Connect(function(key, GP)
if key.KeyCode == Enum.KeyCode.H and not GP then
print("Healing!")
game.ReplicatedStorage.HealStart:FireServer(script.Parent)
end
end)
UIS.InputEnded:Connect(function(key, GP)
if key.KeyCode == Enum.KeyCode.H and not GP then
print("Stopped!")
game.ReplicatedStorage.StopHealing:FireServer(script.Parent)
end
end)
Add these remoteEvents to ReplicatedStorage
StopHealing
HealStart
Create a remote event at the replicated storage Called “Heal”
Add a local script to the Starter Player Scripts,
then put this code in:
local UIS = game:GetService("UserInputService")
UIS.InputBegan:Connect(function(key)
if key.KeyCode == Enum.KeyCode.E then
game.ReplicatedStorage.Heal:FireServer() -- create a remote event called "Heal"
end
end)
then you need to create a SCRIPT (not a local script) to the serverscriptservice,
and put this code in:
game.ReplicatedStorage.Heal.OnServerEvent:Connect(function(player)
player.Character.Humanoid.Health += 2.2
end)
hope this help!
(Btw if youre new in devforum, you can press the solution button if the problem is solved)
how you gonna get the target
can you show ur script
local rep = game:GetService(“ReplicatedStorage”)
local Debris = game:GetService(“Debris”)
–//{ANIM}\–
local player = script.Player
local enemy = script.Enemy
rep.Stand.TW.BloodSuck.OnServerEvent:Connect(function(Player)
local char = Player.Character
local hum = char.Humanoid
local sucking = script.BloodSucking:Clone()
sucking.Parent = char
local newhp = 6
local ignorelist = {}
local Hitbox = script.Hitbox:Clone()
Hitbox.Parent = game.Workspace
Hitbox.CFrame = char.PrimaryPart.CFrame * CFrame.new(0,0,Hitbox.Size.Z/2 * -1)
Debris:AddItem(Hitbox,.3)
local Connection
Connection = Hitbox.Touched:Connect(function(hitpart)
if not hitpart:IsDescendantOf(char) then
if hitpart.Parent:FindFirstChild("Humanoid") then
local enemy = hitpart.Parent
if (table.find(ignorelist,enemy) == nil) then
table.insert(ignorelist,enemy)
Connection:Disconnect()
char.Humanoid.WalkSpeed = 0
char.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, false)
Player.Backpack.Value.UsingMove.Value = true
enemy.Humanoid.WalkSpeed = 0
enemy.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, false)
-- Enemy.Backpack.Value.UsingMove.Value = true
--enemy.Humanoid:LoadAnimation(hitanim):Play()
sucking:Play()
local Blood = script.Blood:Clone()
Blood.Parent = enemy.UpperTorso
enemy.Humanoid:TakeDamage(1.1)
wait(0.5)
enemy.Humanoid:TakeDamage(1.5)
local Blood = script.Blood:Clone()
Blood.Parent = enemy.UpperTorso
hum.Health += newhp
wait(0.5) -- 1
enemy.Humanoid:TakeDamage(1.5)
hum.Health += newhp
wait(0.5)
enemy.Humanoid:TakeDamage(1.5)
hum.Health += newhp
wait(0.5) --2
enemy.Humanoid:TakeDamage(1.5)
hum.Health += newhp
wait(0.5)
enemy.Humanoid:TakeDamage(1.5)
hum.Health += newhp
wait(0.5) --3
enemy.Humanoid:TakeDamage(1.5)
hum.Health += newhp
wait(0.5)
enemy.Humanoid:TakeDamage(1.5)
hum.Health += newhp
wait(0.5) --4
enemy.Humanoid:TakeDamage(1.5)
hum.Health += newhp
wait(0.5)
enemy.Humanoid:TakeDamage(1.5)
hum.Health += newhp
wait(0.5) --5
enemy.Humanoid:TakeDamage(1.5)
hum.Health += newhp
wait(0.5)
enemy.Humanoid:TakeDamage(1.5)
hum.Health += newhp
wait(0.5) --6
enemy.Humanoid:TakeDamage(1.5)
hum.Health += newhp
wait(0.8)
enemy.Humanoid:TakeDamage(8)
sucking:Destroy()
Blood:Destroy()
Player.Backpack.Value.UsingMove.Value = true
enemy.Humanoid.WalkSpeed = 16
-- Enemy.Backpack.Value.UsingMove.Value = false
enemy.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, true)
char.Humanoid.WalkSpeed = 16
char.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, true)
end
end
end
end)
end)
rep.Stand.TW.BloodSuck.OnServerEvent:Connect(function(Player)
local Character = Player.Character
local Stand = Character.Stand
local AnimControl = Stand:WaitForChild(“AnimationController”)
if Stand then
if Player.Backpack.Value.UsingMove.Value == false then
Player.Backpack.Value.UsingMove.Value = true
-- Character.Humanoid:LoadAnimation(Player):Play()
wait(1.25)
Player.Backpack.Value.UsingMove.Value = false
end
end
end)
Wow, the code is very messy! You can make a loop to heal the humanoid.