-
What do you want to achieve? Keep it simple and clear!
Working on a kitchen thing rn, but I need to know something, if the player clicked a part with a click detector, how would I check if the player is holding a specific part, example would be that, the player is putting something in an oven, how would I know if he is holding that pizza? -
What is the issue? Include screenshots / videos if possible!
No issue, other than being completely clueless. -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
My good old friend google.
2 Likes
Players can’t interact with ClickDetectors when equipping a Tool, due to the .Activated
event in tools. You’ll have to work around this by either:
- Inserting a ProximityPrompt that checks for the tool in the Player’s character.
- Make it such that the ClickDetector finds the tool in the Player’s backpack without having the Player equip it.
How would I do #1? Is there a page that you can direct me to?
I can just guide you from here.
To do Method #1, you will need to insert:
- A
ProximityPrompt
, which should be parented under a part in the oven. - A ServerScript, which you can place parented under the
ProximityPrompt
.
Server script:
local proximityPrompt = script.Parent
proximityPrompt.Triggered:Connect(function(Player)
for i, child in pairs(Player.Character:GetChildren()) do -- We are checking whether the Player has equipped the tool, which would be parented under their character if they did.
if child:IsA(“Tool”) and child.Name == “” then -- Insert tool name here.
-- Other code here.
end
end
end)
1 Like
Thank you, I will test it later and let you know if it works!
1 Like
This is very redundant, why a loop?
local proximityPrompt = script.Parent
proximityPrompt.Triggered:Connect(function(Player)
if Player.Character:FindFirstChild(ToolNameHere) then
end
end)
4 Likes
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.