Hey! I’m not an advanced programmer whatsoever, I’m just now starting to learn Lua. I need assistance on a tool giving interface!
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.
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.
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!
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)
Incase you need me to explain my problem in more detail, just reply to this post and I’ll explain!
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!
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.