How do I make a model appear when a tool is recieved?

  1. What do you want to achieve? Make a model’s (obby) transparency set to 0 when the player receives a tool

  2. What is the issue? I don’t know how to add the model to the script or for the tool to be the trigger.

  3. What solutions have you tried so far? A script but the trigger is when a part is clicked, not when the tool is in the inventory.

I want to script the entire model instead of individual parts of it, if it’s not possible then how would I script the parts? And, how would I make the tool be the trigger, not a part?

Here is the script:

   local Obby1 = game.Workspace.Obby1 --  'Obby1' is a part of the model

   script.Parent.ClickDetector:Connect(function(click) 
         if click.Parent:FindFirstChild("Humanoid") then

         Obby1.Transparency = 0
      end
 end)

P.S. I am a newbie at scripting pls have mercy

you mean when tool is inside player’s backpack or when player equipped it?
and what’s the tool name?

When the tool is inside the backpack. Tool name is “curiosity” but its just a jar.

You can detect new tool being add using ChildAdded
and for setting the entire model transparency you use GetChildren() or GetDescendants() to get all the part inside model

This is the script

local Obby1 = game.Workspace. --change this to Obby model 

game.Players.PlayerAdded:Connect(function(plr)
    plr:WaitForChild('Backpack').ChildAdded:Connect(function(tool)
        if tool.Name == 'curiosity' then
            for i,v in pairs(Obby1:GetDescandants()) do
                if v:IsA('BasePart') then
                    v.Transparency = 0
                end
            end
        end
    end)
end)

but If you only want obby to show to only the player that have the tool then you might use localscript instead and change the script a little bit

thank you! where would I put the script btw

ServerScriptService probably work best

I tried it but it doesn’t work. I put it in the right place and changed ‘Obby1’ accordingly.

The one I was using before is not working now either lolll!!!

I believe I have a solution but could you please clarify one thing first:

Do you want the model to be transparent when the player gets the tool, holds the tool, or when they activate (left mouse button) the tool?

Edit: Is the transparency going to be visible to everyone or just the player with the tool?

I want the model to be -not- transparent when the player gets the tool. Visibility to player w/ the tool but it’s a single player game.

I figured it out kind of. I ended up using a script just for when I click a part, the obby appears, instead of having the tool. also ungrouped the obby and put all the parts in a folder and now its working. this happened with every model though, tried to script them and it wouldn’t work until after I ungrouped the parts.

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