Tool appearing in player's backpack

Hello DevForum!

  1. What do you want to achieve?
    What I am aiming to achieve is to create a simulator shop where when a player presses a GUI button it gives them a drink and then they can drink from it with the proper animation

  2. What is the issue? Include screenshots / videos if possible!
    The issue at hand is when a player presses the GUI it gives them the tool however the animation for the tool isn’t working. Whenever I put the tool straight into starterpack the animation works however whenever the tool is received through the GUI the tool’s animation no longer works.

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    So far I have tried changing the animation scripts. I have tried going through serverStorage instead of ReplicatedStorage however no solutions have worked.

Give tool script (via GUI)


local tool = game.ReplicatedStorage.SparklingWater
local player = game.Players.LocalPlayer
local backpack = game.Players.LocalPlayer.Backpack

script.Parent.MouseButton1Click:Connect(function()
	tool:Clone()
	tool:Clone().Parent = backpack
end)

Animation script

local Tool = script.Parent;

enabled = true




function onActivated()
	if not enabled  then
		return
	end

	enabled = false
	Tool.GripForward = Vector3.new(0,-.759,-.651)
	Tool.GripPos = Vector3.new(1.5,-.5,.3)
	Tool.GripRight = Vector3.new(1,0,0)
	Tool.GripUp = Vector3.new(0,.651,-.759)


	Tool.Handle.DrinkSound:Play()

	wait(1)
	
	local h = Tool.Parent:FindFirstChild("Humanoid")
	if (h ~= nil) then
		if (h.MaxHealth > h.Health + 5) then
			h.Health = h.Health + 5
		else	
			h.Health = h.MaxHealth
		end
	end

	Tool.GripForward = Vector3.new(-.976,0,-0.217)
	Tool.GripPos = Vector3.new(0.03,0,0)
	Tool.GripRight = Vector3.new(.217,0,-.976)
	Tool.GripUp = Vector3.new(0,1,0)

	enabled = true

end

function onEquipped()
	Tool.Handle.OpenSound:play()
end

script.Parent.Activated:connect(onActivated)
script.Parent.Equipped:connect(onEquipped)

This is a script I used a long time ago and probably still works,

function give(plr)
	local y = plr.Backpack
	local z = game.ReplicatedStorage["Hot Dog"]
	z:Clone().Parent = y
end

script.Parent.ClickDetector.MouseClick:connect(give)

It should work and the animation seems fine.

replace this with

local player = game.Players.LocalPlayer
local backpack = player.Backpack

replace this with

        local ToolClone = tool:Clone()
        ToolClone.Parent = backpack

In the animation script, there seems to be no animations defined, let alone played. All that seems to be played are sounds.