What do you want to achieve? Make a model’s (obby) transparency set to 0 when the player receives a tool
What is the issue? I don’t know how to add the model to the script or for the tool to be the trigger.
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)
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
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.