Support on Tool-Giving GUI

Hey! I’m not an advanced programmer whatsoever, I’m just now starting to learn Lua. I need assistance on a tool giving interface!

  1. I’m attempting to achieve a working tool giving UI. I’ve gotten the tool giving part working, but I just need assistance with the tool and the tool’s animation.

  2. The issue I’m facing is that the tool giving is working perfectly fine, however, when I click while holding the tool, the animation on the tool doesn’t play. But when the tool is just in StarterPack or just left on the Workspace, it works fine when you click to play the animation.

  3. I’ve searched for solutions on the DevForum, but I wasn’t able to find anything to resolve my issue.

My script will be left below! If you happen to find a solution to my issue, please reply to this post, or you may contact me via DevForum messages! Thank you so much! :slightly_smiling_face:

local tool = script.Parent["Blueberry Cake"]
local player = game.Players.LocalPlayer
local Frame = script.Parent.Parent

script.Parent.MouseButton1Click:Connect(function()
	tool:Clone()
	tool:Clone().Parent = player.Backpack
	Frame:TweenPosition(UDim2.new(-0.5, 0,0.2, 0),"In","Quint",1)
end)

image

Incase you need me to explain my problem in more detail, just reply to this post and I’ll explain!

1 Like

When you say toolanimation what do you mean? Do you mean the animation when you have the item?

Mhm! I have an animation on the tool that’s supposed to play when you click. It works perfectly fine when I just have the tool in my inventory not using the tool giving GUI, but whenever the tool enters my backpack via the tool giving GUI, the animation doesn’t work.

Try to put the tool in replicated storage and try to use a remote event to fire it from the client side to the server

so like this:
Local script
script.Parent.MouseButton1Click:Connect(function()
game.ReplicatedStorage.RemoteEvent:FireServer()
Frame:TweenPosition(UDim2.new(-0.5, 0,0.2, 0),“In”,“Quint”,1)
end)

Script in server:
local tool = game.ReplicatedStorage[“Blueberry Cake”]:Clone()
game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(plr)
tool.Parent = plr.Backpack
end)

This should work if you have any problems feel free to ask me!

1 Like

The “Script in server” is support to go in ServerScriptService, correct? If so, the script isn’t working. The GUI tweening works and it moves away, but the tool doesn’t go into my backpack.

Here is proof that it works btw

https://gyazo.com/9cae39bec0f874d93be60ffb4fd62397

Try this script in server script service

game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(plr)

local Cupcake = game.ReplicatedStorage[“Cupcake Blue”]:Clone()

Cupcake.Parent = plr.Backpack

end)

1 Like

Remember to fire it from your local script btw

It works now, thank you so much!

1 Like

No problem! If you ever need help just shoot me a dm on discord or here on devforum

Discord: MauBicho#1588

1 Like