Hey, I have made 2 drinks tools, one makes you shoot up in the air and the other makes you run fast. When you drink the one that makes you shoot in the air, it works fine, but if I use the one that makes you run fast afterwards, it also shoots you up on the air. If I use the one that makes you run fast first, it works as intended and the one that makes you shoot up in the air works as intended, it somehow conflicts if I use the air one first.
They are both the same model, but are different colours.
Here's the code:
Speed LocalScript:
-- Tool Variables
local tool = script.Parent
local handle = tool:WaitForChild("Handle")
-- Local Player Variables --
local plr = game.Players.LocalPlayer
repeat wait() until plr.Character
local human = plr.Character:WaitForChild("Humanoid")
local mouse = plr:GetMouse()
-- Animation Variables --
local drinkAnim= Instance.new("Animation")
drinkAnim.AnimationId= "rbxassetid://1294065907"
local animDrink = human:LoadAnimation(drinkAnim)
-- Drink Variables --
local speed = 32
-- Tool Equipped --
tool.Equipped:Connect(function()
if human.Health <= 0 then return end
-- Drink And Play Animation --
mouse.Button1Down:Connect(function()
if human.Health <= 0 then return end
human.WalkSpeed = 0
animDrink:Play()
wait(2)
human.WalkSpeed = speed
wait(20)
human.WalkSpeed = 16
end)
end)
Air LocalScript
-- Tool Variables
local tool = script.Parent
local handle = tool:WaitForChild("Handle")
-- Local Player Variables --
local plr = game.Players.LocalPlayer
repeat wait() until plr.Character
local character = plr.Character
local human = character:WaitForChild("Humanoid")
local mouse = plr:GetMouse()
-- Animation Variables --
local drinkAnim= Instance.new("Animation")
drinkAnim.AnimationId= "rbxassetid://1294065907"
local animDrink= human:LoadAnimation(drinkAnim)
-- Drink Variables --
-- NA
function rocketJump()
if character and character:findFirstChild("Humanoid") then
local b = Instance.new("BodyPosition")
b.position = Vector3.new(0, 600, 0)
b.maxForce = Vector3.new(0, 500000000, 0)
b.Parent = character.UpperTorso
wait(3)
b.Parent = nil
end
end
-- Tool Equipped --
tool.Equipped:Connect(function()
if human.Health <= 0 then return end
-- Drink Potion And Play Animation --
mouse.Button1Down:Connect(function()
if human.Health <= 0 then return end
human.WalkSpeed = 0
animDrink:Play()
wait(2)
rocketJump()
human.WalkSpeed = 16
end)
end)

2 comments
19 local animDrink= human:LoadAnimation(drinkAnim)
What about it?