Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can I get :Destroy() to delete the tool while equipping it?

Asked by
MemezyDev 172
4 years ago
Edited 4 years ago

I am making a tool that is raw beef and I was gonna make it so after a certain amount of bites, the tool gets destroyed. I am destroying on the server, and I did connect with remotes. The tool does get destroyed, but after I unequip the tool

01--Client
02wait()
03local yes = false
04local tool = script.Parent
05local bites = 0
06local foodHandler = game:GetService('ReplicatedStorage'):WaitForChild('foodHandler')
07local foodItem = tool.Name
08 
09tool.Activated:Connect(function()
10    if not yes then
11        yes = true
12        eatAnim:Play()
13        bites = bites + 1
14        print(bites)
15        wait(3)
View all 30 lines...

everything else in the script works. If you can help me then tysm!

0
instead of doing "if not yes then" have you tried doing "if yes == false then"? Ieowyyn 69 — 4y
0
if not checks if the value is false, if checks if its true MemezyDev 172 — 4y
0
I think I have an Idea Maybe do I a IF Statement to Get the amount of Bites and After It reaches The Amount You Want Move the Tool To Server Storage Magicdevice3 58 — 4y

1 answer

Log in to vote
1
Answered by 4 years ago

if possible use the Humanoid:UnequipTools() function so that it automatically unequips for you

Ad

Answer this question