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

Unequip tool after equipping It script not working?

Asked by 5 years ago

So I'm having an issue right now. I'm making a tool (named "Baseball bat") which is unequipped everytime you equip it if it accomplishes a condition. I'll leave what i got:


local t = script.Parent local handle = t.Handle local player = t.Parent.Parent.Character local torso = player.Torso local RArm = player["Right Arm"] local hum = player.Humanoid t.Equipped:Connect(function(mouse) --if player:WaitForChild("PlayerSettings").Status ~= "None" then hum:UnequipTools() return --end --local weld = createWeld() end)

However, It doesnt work and returns a yellow output:

18:37:09.721 - Something unexpectedly tried to set the parent of Baseball bat to Backpack while trying to set the parent of Baseball bat. Current parent is SnyFort.

0
By any chance, are you deleting the Backapck or changing It's parent? Aimarekin 345 — 5y
0
Nope. The error source is from this script for sure masterjosue1998 116 — 5y
0
I tried something like, instead of using "UnequipTools", to set the players health to 0. When I equipped it It kiled my character. The issue is on UnequipTools masterjosue1998 116 — 5y
0
This happened to be me before. UnequipTools() is kinda glitchy. Like when you teleport players and remove their tools right away it gives you an error and kicks the player from the game. wilsonsilva007 373 — 5y
View all comments (2 more)
0
Yes because unequiptools always parents the tool to the players backpack (the player assigned to the humanoid) ABK2017 406 — 5y
0
I've experienced this before, in a similar scenario to yours. I think it occurs because of the quick parent changing. There is probably a better way to do this, but it worked when I added a wait() before the UnequipTools() function. I don't want to post this as an answer since it's most likely not the best fix. Optikk 499 — 5y

Answer this question