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

How does one go about removing a clone of a part on touch?

Asked by 4 years ago
Edited 4 years ago

I'm very new to roblox studio and this feels like a really dumb question but it's the last part of one of my game mechanics that I need and after going through several different scripts I still don't have an answer. Someone please help...

local debounce = false
local Part = ServerStorage.Iron

function getPlayer(humanoid) 
local players = game.Players:children() 
for i = 1, #players do 
if players[i].Character.Humanoid == humanoid then return players[i] end 
end 
return nil 
end 

function onTouch(part) 

local human = part.Parent:findFirstChild("Humanoid") 
if (human ~= nil) and debounce == false then

debounce = true

local player = getPlayer(human) 

if (player == nil) then return end 

script.Parent.IronOre:clone().Parent = player.Backpack 
wait(2)
debounce = false
end
end


script.Parent.Touched:connect(onTouch)

local Part = ServerStorage.Iron
Part:Destroy()

I don't really know what's wrong...

0
as i see the biggest problem is you placed 1 function into the function gloveshun 119 — 4y
0
2* gloveshun 119 — 4y
0
Wdym?? RobbyBobby2643 2 — 4y

1 answer

Log in to vote
0
Answered by
gloveshun 119
4 years ago

Give the script, and i will fix it

0
Oh- my bad hold on RobbyBobby2643 2 — 4y
0
yes gloveshun 119 — 4y
0
the script looks like right, unless the returt gloveshun 119 — 4y
0
return* gloveshun 119 — 4y
Ad

Answer this question