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

How do I make a player unable to pick up certain tools?

Asked by
shackfu 14
5 years ago
Edited 5 years ago

I want to make it so that the player can only have one primary weapon, but I can't find any way to make a player unable to pick up a tool when they touch it. Edit: I have an idea. If I make it so that when the player is within a certain distance of a weapon and presses a button, it puts the tool in their backpack. The only problem is that i'm not sure how to find the magnitude between the player and any weapon pickup in particular that is dropped. Can someone help?

0
have you tried to make a script for it yet? XxHyperglassxX 4 — 5y
0
you need some way to check if a tool is a primary or not like having a table of primary weapon names or using a bool value hellmatic 1523 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

Put this local script in starter player!

While wait() do
        Local tools = script.Parent.Parent.Backpack:GetChildren()
        for i = 1, #tools do
             local tool = tools[i]
             tool:Destroy()
       end
end)

My capitalisations May be wrong cause I’m on a iPad! If you need anymore help ask.

0
A: That destroys all tools in the backpack, B: Local and While aren't capitalized, C:you should explain your code and why it should work theking48989987 2147 — 5y
Ad

Answer this question