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

How Do I Make It To Where When I Walk Over An Item It Goes Into My Inventory?

Asked by 3 years ago

I've tried watching tutorials and reading post's on this website but i just 1, can't rap my head around it and making the script work towards what my game is or 2, it just doesn't work properly when i put in the code. Any ideas? Clarifications: when i walk over the item it disappears, also in the game im making we would use said items to upgrade our current Dummy (i dont have a name for it yet), so i would also like help understanding/coding how i would implement that "Upgrading" of your Dummy thing.

0
Well if that item is a tool type, its already predefined that when you walk on it you will receive it instantly yuni_Boy1234 320 — 3y

1 answer

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

Try using this script, it will simply clone a tool to the player's backpack once walked on using the OnTouched() function. (Edit tool to the tools name, and you will likely need to edit this to match with your game.)

local db = true --Debounce
game.Players.PlayerAdded:Connect(function(player) -- gets local player
script.Parent.Touched:Connect(function()
    if db == true then
        script.Parent.Tool:Clone().Parent = player:WaitForChild('Backpack')
        db = false
        wait(3)
        db = true
        end
     end)
end)

0
1, thanks for the help 2, i have had it (before i made this) to where when i click on an item it goes into my inventory but thats not what i wanted, i know that with the way i did it before you put like a script in the tool have text in there that says clone from replicated storage or server storage and i dont know if i would do the same or what, like do i have to have a separate mesh outside WeabuAtTheMax 11 — 3y
0
the tool or what, or do i have to have the mesh in the tool and where do i change the script at, ive tried but i also need to know the prerequisites to where i am supposed to put things. WeabuAtTheMax 11 — 3y
0
i have figured it out WeabuAtTheMax 11 — 3y
Ad

Answer this question