local proxPrompt = script.Parent.base.ProximityPrompt
local plateModel = script.Parent
proxPrompt.Triggered:Connect(function(player)
print("Proximity prompt triggered")
if player then
print("Player found:", player.Name)
local character = player.Character
if character then
print("Character found for player:", player.Name)
local humanoid = character:FindFirstChildOfClass("Humanoid")
if humanoid then
print("Humanoid found for player:", player.Name)
local tool = humanoid:FindFirstChild("Activated") -- Buscar la herramienta activada
if tool then
print("Tool activated for player:", player.Name)
-- Clonar el modelo del plato debajo de la herramienta
local plateClone = plateModel:Clone()
plateClone.Parent = tool
plateClone:SetPrimaryPartCFrame(tool.Handle.CFrame * CFrame.new(0, -1, 0)) -- Ajustar la posición debajo de la herramienta
print("Plate cloned and positioned under activated tool for player:", player.Name)
else
print("No activated tool found for player:", player.Name)
end
else
print("No humanoid found for player:", player.Name)
end
else
print("No character found for player:", player.Name)
end
else
print("No player found")
end
end)
local proxPrompt = script.Parent.base.ProximityPrompt
local plateModel = script.Parent
proxPrompt.Triggered:Connect(function(player)
print("Proximity prompt triggered")
if player then
print("Player found:", player.Name)
local character = player.Character
if character then
print("Character found for player:", player.Name)
local humanoid = character:FindFirstChildOfClass("Humanoid")
if humanoid then
print("Humanoid found for player:", player.Name)
-- Connect the Activated event outside the for loop
local activatedTool = nil
for _, tool in pairs(player.Backpack:GetChildren()) do
if tool:IsA("Tool") then
if tool.Activated then
tool.Activated:Connect(function()
activatedTool = tool
end)
end
end
end
-- Wait a short time for the Activated event to be triggered
wait(0.1)
-- Check for an activated and equipped tool
if activatedTool and activatedTool:IsEquipped() then
print("Activated and equipped tool found for player:", player.Name)
-- Clone the plate model under the activated and equipped tool
local plateClone = plateModel:Clone()
plateClone.Parent = activatedTool
plateClone:SetPrimaryPartCFrame(activatedTool.Handle.CFrame * CFrame.new(0, -1, 0)) -- Adjust the position under the tool
print("Plate cloned and positioned under activated and equipped tool for player:", player.Name)
else
print("No activated and equipped tool found for player:", player.Name)
end
else
print("No humanoid found for player:", player.Name)
end
else
print("No character found for player:", player.Name)
end
else
print("No player found")
end
end)
local proxPrompt = script.Parent.base.ProximityPrompt
local plateModel = script.Parent
proxPrompt.Triggered:Connect(function(player)
print("Proximity prompt triggered")
if player then
print("Player found:", player.Name)
local character = player.Character
if character then
print("Character found for player:", player.Name)
local humanoid = character:FindFirstChildOfClass("Humanoid")
if humanoid then
print("Humanoid found for player:", player.Name)
local activatedTool = nil
-- Connect the Activated event outside the loop
local backpack = player.Backpack:GetChildren()
for _, tool in ipairs(backpack) do
if tool:IsA("Tool") then
print("Connecting Activated event for tool:", tool.Name)
tool.Activated:Connect(function()
activatedTool = tool
end)
end
end
-- Wait for the Activated event to be triggered
wait(0.1)
-- Check for an activated and equipped tool
if activatedTool and activatedTool:IsEquipped() then
print("Activated and equipped tool found for player:", player.Name)
-- Clone the plate model under the activated and equipped tool
local plateClone = plateModel:Clone()
plateClone.Parent = activatedTool
plateClone:SetPrimaryPartCFrame(activatedTool.Handle.CFrame * CFrame.new(0, -1, 0)) -- Adjust the position under the tool
print("Plate cloned and positioned under activated and equipped tool for player:", player.Name)
else
print("No activated and equipped tool found for player:", player.Name)
end
else
print("No humanoid found for player:", player.Name)
end
else
print("No character found for player:", player.Name)
end
else
print("No player found")
end
end)
Uuuh no he’s right. What he meant is finding the tool in Player Character not in player backpack
You can change to
Local backpack = character:GetDescendants()
local plateModel = script.Parent
local proxPrompt = plateModel.base.ProximityPrompt
local function onTriggered(player)
if player.Character then
local tool = player.Character:FindFirstChild("Activated")
if tool then
local plateClone = plateModel:Clone()
plateClone:PivotTo(tool.Handle.CFrame * CFrame.new(0, -1, 0))
plateClone.Parent = tool
end
end
end
proxPrompt.Triggered:Connect(onTriggered)
Oh! I managed to solve it!
Now I just need to remove the proximity prompt from my cloned part, anchor it to my tool, and take care of those details. Thanks for the help! Who do I give the resolve to? Everyone helped me a lot.
local proxPrompt = script.Parent.base.ProximityPrompt
local plateModel = script.Parent
proxPrompt.Triggered:Connect(function(player)
print("Proximity prompt triggered")
if player then
print("Player found:", player.Name)
local character = player.Character
if character then
print("Character found for player:", player.Name)
local humanoid = character:FindFirstChildOfClass("Humanoid")
if humanoid then
print("Humanoid found for player:", player.Name)
local activatedTool = nil
-- Connect the Activated event outside the loop
local backpack = character:GetChildren()
for _, tool in ipairs(backpack) do
if tool:IsA("Tool") then
print("Connecting Activated event for tool:", tool.Name)
if tool.Activated then
activatedTool = tool
break
end
end
end
-- Wait for the Activated event to be triggered
wait(0.1)
-- Check if the activated tool is equipped
if activatedTool and activatedTool.Parent == character then
print("Activated and equipped tool found for player:", player.Name)
-- Clone the plate model under the activated and equipped tool
local plateClone = plateModel:Clone()
plateClone.Parent = activatedTool
plateClone:SetPrimaryPartCFrame(activatedTool.Handle.CFrame * CFrame.new(0, -1, 0)) -- Adjust the position under the tool
print("Plate cloned and positioned under activated and equipped tool for player:", player.Name)
else
print("No activated and equipped tool found for player:", player.Name)
end
else
print("No humanoid found for player:", player.Name)
end
else
print("No character found for player:", player.Name)
end
else
print("No player found")
end
end)
This should work to make the model move with the Tool
It’s guaranteed to remove the prompt from the clone at least:
local proxPrompt = script.Parent.base.ProximityPrompt
local plateModel = script.Parent
proxPrompt.Triggered:Connect(function(player)
print("Proximity prompt triggered")
if player then
print("Player found:", player.Name)
local character = player.Character
if character then
print("Character found for player:", player.Name)
local humanoid = character:FindFirstChildOfClass("Humanoid")
if humanoid then
print("Humanoid found for player:", player.Name)
local activatedTool = nil
-- Connect the Activated event outside the loop
local backpack = character:GetChildren()
for _, tool in ipairs(backpack) do
if tool:IsA("Tool") then
print("Connecting Activated event for tool:", tool.Name)
if tool.Activated then
activatedTool = tool
break
end
end
end
-- Wait for the Activated event to be triggered
wait(0.1)
-- Check if the activated tool is equipped
if activatedTool and activatedTool.Parent == character then
print("Activated and equipped tool found for player:", player.Name)
-- Clone the plate model under the activated and equipped tool
local plateClone = plateModel:Clone()
plateClone.base.ProximityPrompt:Destroy()
plateClone.Parent = activatedTool
plateClone:SetPrimaryPartCFrame(activatedTool.Handle.CFrame * CFrame.new(0, -1, 0)) -- Adjust the position under the tool
print("Plate cloned and positioned under activated and equipped tool for player:", player.Name)
local weld = Instance.new("WeldConstraint")
weld.Part0 = activatedTool.Handle
weld.Part1 = plateClone.base
weld.Parent = activatedTool
plateClone.base.Anchored = false
else
print("No activated and equipped tool found for player:", player.Name)
end
else
print("No humanoid found for player:", player.Name)
end
else
print("No character found for player:", player.Name)
end
else
print("No player found")
end
end)
@PipeSader This method might work better if the Model contains multiple parts:
local proxPrompt = script.Parent.base.ProximityPrompt
local plateModel = script.Parent
proxPrompt.Triggered:Connect(function(player)
print("Proximity prompt triggered")
if player then
print("Player found:", player.Name)
local character = player.Character
if character then
print("Character found for player:", player.Name)
local humanoid = character:FindFirstChildOfClass("Humanoid")
if humanoid then
print("Humanoid found for player:", player.Name)
local activatedTool = nil
-- Connect the Activated event outside the loop
local backpack = character:GetChildren()
for _, tool in ipairs(backpack) do
if tool:IsA("Tool") then
print("Connecting Activated event for tool:", tool.Name)
if tool.Activated then
activatedTool = tool
break
end
end
end
-- Wait for the Activated event to be triggered
wait(0.1)
-- Check if the activated tool is equipped
if activatedTool and activatedTool.Parent == character then
print("Activated and equipped tool found for player:", player.Name)
-- Clone the plate model under the activated and equipped tool
local plateClone = plateModel:Clone()
plateClone.base.ProximityPrompt:Destroy()
plateClone.Parent = activatedTool
plateClone:SetPrimaryPartCFrame(activatedTool.Handle.CFrame * CFrame.new(0, -1, 0)) -- Adjust the position under the tool
print("Plate cloned and positioned under activated and equipped tool for player:", player.Name)
for _, instance in plateClone:GetDescendants() do
if instance:IsA("BasePart") then
local weld = Instance.new("WeldConstraint")
weld.Part0 = activatedTool.Handle
weld.Part1 = instance
weld.Parent = activatedTool
instance.Anchored = false
end
end
else
print("No activated and equipped tool found for player:", player.Name)
end
else
print("No humanoid found for player:", player.Name)
end
else
print("No character found for player:", player.Name)
end
else
print("No player found")
end
end)
local proxPrompt = script.Parent.Handle.ProximityPrompt
local plateModel = script.Parent
proxPrompt.Triggered:Connect(function(player)
print("Proximity prompt triggered")
if player then
print("Player found:", player.Name)
local character = player.Character
if character then
print("Character found for player:", player.Name)
local humanoid = character:FindFirstChildOfClass("Humanoid")
if humanoid then
print("Humanoid found for player:", player.Name)
local activatedTool = nil
-- Connect the Activated event outside the loop
local backpack = character:GetChildren()
for _, tool in ipairs(backpack) do
if tool:IsA("Tool") then
print("Connecting Activated event for tool:", tool.Name)
if tool.Activated then
activatedTool = tool
break
end
end
end
-- Wait for the Activated event to be triggered
wait(0.1)
-- Check if the activated tool is equipped
if activatedTool and activatedTool.Parent == character then
print("Activated and equipped tool found for player:", player.Name)
-- Clone the plate model under the activated and equipped tool
local plateClone = plateModel:Clone()
plateClone.Handle.ProximityPrompt:Destroy()
plateClone.Parent = activatedTool
plateClone:SetPrimaryPartCFrame(activatedTool.Handle.CFrame * CFrame.new(0, -1, 0)) -- Adjust the position under the tool
print("Plate cloned and positioned under activated and equipped tool for player:", player.Name)
for _, instance in plateClone:GetDescendants() do
if instance:IsA("BasePart") then
local weld = Instance.new("WeldConstraint")
weld.Part0 = activatedTool.Handle
weld.Part1 = instance
weld.Parent = activatedTool
instance.Anchored = false
end
end
else
print("No activated and equipped tool found for player:", player.Name)
end
else
print("No humanoid found for player:", player.Name)
end
else
print("No character found for player:", player.Name)
end
else
print("No player found")
end
end)