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

Why doesn't my gun get removed?

Asked by 9 years ago

You know how when your gun is equipped or unequipped the gun is in different places right? That is my problem.

I tried two scripts to solve this. 1 for the gun in the character, and 1 for the gun being in the player's backpack.

The purpose of the script is to remove the gun when you stand up after you were sitting down from a certain seat.

Is there anything wrong with these scripts?

--When gun is equipped
while true do
    wait()
    if script.Parent.Parent:FindFirstChild("Humanoid").Sit == false then
        script.Parent:remove()
    end
end
--When gun is unequipped
while true do
    wait()
    if script.Parent.Parent.Parent:FindFirstChild("Character"):FindFirstChild("Humanoid").Sit == false then
        script.Parent:remove()
    end
end

I need an answer immediately.

0
Replace :remove() with :Destroy(). HungryJaffer 1246 — 9y
0
Your problem is lines 4 of the first and second code; 'Humanoid' is not existant within the Player itself, and the Player's Character is not existant within the Player; The 'Character' is a property to specify the Player's Character; Not a Child within the Player itself. :P TheeDeathCaster 2368 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

You misspelled Humanoid in the 4th line of When the gun is unequiped

0
Umm the code block cut off part of the script and no I spelled it correctly. laughablehaha 494 — 9y
Ad

Answer this question