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...
Give the script, and i will fix it