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.
#Bandage Tool Script
31 messages · Page 1 of 1 (latest)
why is this a local script
Is it supposed to be a script?
the key thing can be a local scirpt
but the heal and the animation
are suppost to be on a normal/server script
Alright I'll try to do it like t hat
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.
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)```
yeah
Alright
Doesn't seem to work, do you think I might've messed something up
Nothing is showing in the output as well
Oh the animation plays now, but the healing doesn't seem to work
huh
it should
maybe change local character = game.Workspace:FindFirstChild(plr.Name) to local character = plr.Character
Weird, still doesn't seem to work
Strange, though I do appreciate the help. Thanks so much.
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.
huh
its the same thing
but if it works then ok ig
good to know