I am trying to make a stew that the player can eat.
The problem is that if the tool starts in StarterPack it works but if it starts in ReplicatedStorage, it dosent. I have no idea why.
Here is the local script parented to the tool:
local Player = game:GetService("Players").LocalPlayer
local Character = Player.CharacterAdded:Wait()
local Animations = script.Parent.Animations
local HoldStewAnimation = Character:WaitForChild("Humanoid"):LoadAnimation(Animations.HoldStew)
HoldStewAnimation.Looped = true
local DrinkStewAnimation = Character:WaitForChild("Humanoid"):LoadAnimation(Animations.DrinkStew)
DrinkStewAnimation.Looped = false
script.Parent.Activated:Connect(function()
script.Parent.Handle.Slurp:Play()
DrinkStewAnimation:Play()
DrinkStewAnimation.Ended:Wait()
task.wait(0.3)
script.Parent.DrinkStew:FireServer()
HoldStewAnimation:Stop()
script.Parent:Destroy()
end)
script.Parent.Equipped:Connect(function()
HoldStewAnimation:Play()
end)
script.Parent.Unequipped:Connect(function()
HoldStewAnimation:Stop()
end)
Their is also a server script in the tool that changes gives the player hunger back:
script.Parent.DrinkStew.OnServerEvent:Connect(function(Player)
Player.Character.Hunger.Value = Player.Character.Hunger.Value + 800
if Player.Character.Hunger.Value > 1200 then
Player.Character.Hunger.Value = 1200
end
end)