Need help with this inventory code

The first code snippet should be in a regular server script parented to your ClickDetector. The second one is what you should replace your current LocalScript with. I’m not sure where you put yours, but I ran mine from StarterPlayerScripts.

Is the model what you click to give the tool? If so, then no. What I meant was put the tool you what to give the Player in ServerStorage. The tool should only be in ServerStorage, and in workspace the model. You can make it a tool if you want, but you don’t have to.

Quick note: Your ClickDetector should not be parented directly under your model but rather inside of a part as a child of said model.

1 Like

@PlainJordan Did my reply help you at all?

1 Like

He has gone inactive, Probably just gave up on development as it was too hard.

1 Like

I’m starting to think that. It’s weird, though, just about every topic I reply to, the creator goes inactive after I say something. Just a coincidence, but strange.

1 Like

I’m quite sure this will work.

Instead of:

local backpack = player:FindFirstChild("Backpack")
local clickDetector = cup:FindFirstChild("ClickDetector")

Try:

local backpack = player:WaitForChild("Backpack")
local clickDetector = cup:WaitForChild("ClickDetector")

Because both may not have loaded yet.

You said:

if player:FindFirstChild("Backpack") then

Which means that the code will run ONLY if it found Backpack inside the player, but if it didn’t, the code stored under the if statement won’t run.

The code didn’t run, which means that it hasn’t found Backpack inside the player.

So use WaitForChild("Backpack") to wait for the Backpack to load.

1 Like

Nah, I saw him online at Studio just now.

He may just not be using the DevForum.

1 Like

This also happens to me often lol

1 Like

Nah sorry mate like sherif mentioned i dont get on the forum that much and i had exams the whole month after so i didnt get much time to work on it.

but in conclusion i found a easier method and used that tbh.
Thx for your help i used some parts of it.

2 Likes

That’s alright!

Glad you figured it out and that my code helped you!

2 Likes

just figuring out how to fix part 2 of the code im working on

2 Likes

I can try to help you if you want! DM me the script and I’ll see what I can do!

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.