Pickup
A pickup system lets players pick up different kinds of objects.
Add a Part and rename it PickupPart.
Add a Script and rename it PickupPartScript
In this script, when the Humanoid touches the part, it will disappear and reappear.
Make sure the part is anchored otherwise this script will not work.
1
local pickup = script.Parent
2
local db = true
3
pickup.Touched:Connect(function(hit)
4
local char = hit.Parent -- any parts making contact
5
local hum = char:FindFirstChild("Humanoid")
6
7
if db and hum then
8
db = false
9
pickup.Transparency = 1 -- this makes the part disappear
10
pickup.CanCollide = false -- turn off can collide with part
11
print("collided")
12
wait(2)
13
print("stopped waiting")
14
pickup.Transparency = 0 -- this makes the part reappear
15
pickup.CanCollide = true -- turn on collide with part
16
db = true
17
end
18
end)
Copied!

Last modified 11mo ago
Export as PDF
Copy link
Contents