#Bandage Tool Script

31 messages · Page 1 of 1 (latest)

tidal quest
#

local plr = game.Players.LocalPlayer
local char = plr.Character
local humanoid = char:FindFirstChild("Humanoid")

local animation = script:FindFirstChild("Animation")
local bKeyPressed, ToolEquipped = false, false

local toolEquipped = true

UIS.InputBegan:Connect(function(input, GameProccessedEvent)
    if GameProccessedEvent == false and ToolEquipped then
        if input.KeyCode == Enum.KeyCode.B then
            bKeyPressed = true
            animation:Play()
            humanoid.Health += 15
            print("B Key Pressed, Health is".. humanoid.Health)
        end
    end
end)```

There isn't a specific bug, but it just isn't working. If anyone could find any problems to help, it'd be appreciated.
primal imp
#

why is this a local script

tidal quest
primal imp
#

but the heal and the animation

#

are suppost to be on a normal/server script

tidal quest
primal imp
tidal quest
# primal imp use remotes

ServerScript

local animEvent = game.ReplicatedStorage:FindFirstChild("BandageEvent")
local healEvent = game.ReplicatedStorage:FindFirstChild("HealEvent")

animEvent.OnServerEvent:Connect(function(plr)
    local character = game.Workspace:FindFirstChild(plr.Name)
    
    local hum = character:FindFirstChild("Humanoid")
    local animTrack = hum:LoadAnimation(anim)
    
    animTrack:Play()
end)

healEvent.OnServerEvent:Connect(function(plr)
    local character = game.Workspace:FindFirstChild(plr.Name)

    local hum = character:FindFirstChild("Humanoid")
    hum.Health += 15
end)```

**Tool Local Script**
```UIS = game:GetService("UserInputService")

local plr = game.Players.LocalPlayer
local char = plr.Character
local humanoid = char:FindFirstChild("Humanoid")

local animation = script:FindFirstChild("Animation")
local bKeyPressed, ToolEquipped = false, false
local toolEquipped = true

local animEvent = game.ReplicatedStorage:FindFirstChild("BandageEvent")
local healEvent = game.ReplicatedStorage:FindFirstChild("HealEvent")

UIS.InputBegan:Connect(function(input, GameProccessedEvent)
    if GameProccessedEvent == false and ToolEquipped then
        if input.KeyCode == Enum.KeyCode.B then
            animEvent:FireServer()
            healEvent:FireServer()
            print("B Key Pressed, Health is".. humanoid.Health)
        end
    end
end)```

I've tried something like this, just wanna check in if you can see any errors.
primal imp
tidal quest
# primal imp you can do both anim and heal in the same event

Like this?

local bandageEvent = game.ReplicatedStorage:FindFirstChild("BandageEvent")

bandageEvent.OnServerEvent:Connect(function(plr)
    local character = game.Workspace:FindFirstChild(plr.Name)
    
    local hum = character:FindFirstChild("Humanoid")
    local animTrack = hum:LoadAnimation(anim)
    animTrack:Play()

    hum.Health += 15
end)```
primal imp
#

yeah

tidal quest
#

Alright

tidal quest
#

Nothing is showing in the output as well

primal imp
#

toolequipped is set to false

#

this doesnt work cuz you forgot the T

tidal quest
primal imp
#

huh

#

it should

#

maybe change local character = game.Workspace:FindFirstChild(plr.Name) to local character = plr.Character

tidal quest
primal imp
#

huh

#

idk then

tidal quest
#

Strange, though I do appreciate the help. Thanks so much.

tidal quest
# primal imp idk then

Did manage to fix this from hum.Health += 15 to hum.Health = hum.Health + 15, just had a search throughout similar free models and it somewhat helped.

primal imp
#

its the same thing

#

but if it works then ok ig

#

good to know