i tried this code
script.Parent.Parent.Parent.Character.Humanoid:EquipTool(script.Parent)
to equip tool
but it did nothing
it is placed in the tool i need to equip
it execute without error
i tried this code
script.Parent.Parent.Parent.Character.Humanoid:EquipTool(script.Parent)
to equip tool
but it did nothing
it is placed in the tool i need to equip
it execute without error
Does your tool have a handle and is the handle required bool set to true? Can you try finding if the tool is even in the workspace? Do this in the script please
while wait(0.1) do print(workspace:IsAncestorOf(script.Parent)) end
result false
but i can manualy equip the item without problem
Were any of the prints true from the script?
no
and i dont know if this is important but the tool is in backpack
and its local script
Assuming the script you provided is located in a LocalScript in the tool that you want to equip you are trying to get the Player’s Character before it is even added so it is resulting in a nil value. You should wait for the Player’s character to be fully loaded along with it’s humanoid before attempting to equip the tool.
local Player = game.Players.LocalPlayer
local plrChar = Player.CharacterAdded:Wait()
local charHumanoid = plrChar:WaitForChild("Humanoid")
charHumanoid:EquipTool(script.Parent)
Try that?
Edit: Just saw it executes without error, still try what I gave you and see if it changes.
the tool is aded in game not at start
it do the same and i tried to add print after it and it will print it
Okay so just to help me and most likely others out; Where is the tool located? Is it in starterpack or the workspace?
Yeah, I had the exact same issue. :EquipTool() is pretty buggy on server scripts. Your best bet is to stick with auto equipping locally. Unless you already are, then try an external script.
Can you show us the output? I’m sure it will help me and others.
Also, you can try moving the tool inside the Character, since when you equip a tool, that tool will move inside the Player’s Character.
That gave me an idea, you could try parenting the tool in the character.
Yeah, just parent the tool to the character. It equips automatically when you do that.
Output is empty and I need to have it in backpack and I focused on this because I know in order versions it was like this, but now it didn’t move to character when I selected it
If you want to try it I want to auto select drive tool from plane kit
So what you want is the drive tool to be auto-equipped when the Player sits in the driver seat of a Plane?
And you would like the drive-tool to stay within the Player’s backpack.
Do you already have a script to check if the Player gets in a Plane or is what you have in the post all you have?
I have full working plane, but 80% of players did not know how to drive because they did not equipped the drive tool, so I need to make it equipped when I get it (I get it every time I sit in and loose every time I jump out)
Alright, then I would create a script within your Plane’s seat that is detecting if someone is currently flying the Plane. You could also do this vice-versa so a localscript within the Player that is detecting if the Player is currently flying a plane.
Assuming you are using a regular Vehicle Seat you can get who is currently sitting in the seat by using the Seat’s Occupant property.
Here is what I came up with(A regular script that is a child of the Plane’s Vehicle Seat) -
local planeOccupied = false -- Variable to check if Plane is currently occupied
while planeOccupied == false do --If it is not occupied, loop and check if it is occupied
local playerDriving = script.Parent.Occupant -- The current person driving, if no one is driving defaults to nil
if playerDriving then --If someone occupies the plane(Sits in the seat)
planeOccupied = true --Stop the main detection-loop
local player = game.Players:GetPlayerFromCharacter(playerDriving.Parent) --The Occupant of a VehicleSeat is always the Humanoid of the Player currently sitting
local plrBackpack = player:FindFirstChild("Backpack") --With our Player we can get their backpack
local plrDrivingTool = plrBackpack:FindFirstChild("NAMEOFTHETOOL") --Find the tool we want to equip(RENAME THIS TO YOUR DRIVING TOOL)
playerDriving:EquipTool(plrDrivingTool) --Equip the tool
while planeOccupied do --Now while the Plane IS occupied loop and check if the Player leaves the plane
local playerDriving = script.Parent.Occupant --The occupant of the seat
if playerDriving == nil then --If no one is currently sitting then
--You could also use :UnequipTools to Uneqip the driving tool when the Player gets out if you wanted
planeOccupied = false --set the planeOccupied variable to false and restart the detection loop
end
wait()
end
end
wait()
end
So while the Plane’s seat is un-occupied it loops through constantly checking if the seat’s occupant has changed. If a Player sits in the seat, its occupant changes and halts the main While loop from looping and then proceeds to get the Player and the Player’s backpack and equips the tool given. Then it begins another loop that detects if the seat’s occupant turns nil(The player leaves the sit), if this were the case then it just resets the main planeOccupied variable and repeats everything. Where it is detecting if the Player leaves the seat you could also do playerDriving:UnequipTools() which will just Unequip the driving-tool. But this is not needed.
Remember this is another regular script that is a child of the Plane’s seat, this will not work if it is anywhere else(Unless you change up the variables) Also remember to change
local plrDrivingTool = plrBackpack:FindFirstChild("NAMEOFTHETOOL") to be finding the name of your Driving tool. I hope this helped.
I have done this, but this really confused me to what instance I need to use function equip tool
(I give the tool to him only when he drive and only thing I need to equip the tool when I get it to backpack)
But really thank for time with writing this long reply