Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

My simple proximityPrompt is still broken?

I have made a proximity prompt script that should get the tool in your hand and drop it to a certain position of "ToolSpot" But I just can't get it working. I believe it is all correct however whenever i trigger the proximity prompt, nothing happens to the equipped tool.

Script:

local Part = script.Parent
local ToolSpot = script.Parent.Parent.ToolSpot

local function remove(otherPart)
	local humanoid = otherPart.Parent:FindFirstChild('Humanoid')
	local player = game.Players:FindFirstChild(otherPart.Parent.Name)
	if humanoid and player then
		local inHand = otherPart.Parent:FindFirstChildWhichIsA('Tool')
		if inHand then
			inHand.Parent = game.Workspace
			inHand.Handle.Position = ToolSpot.Position
		end
	end
end
Part.ProximityPrompt.Triggered:Connect(remove)

Any advice, help, etc is highly appreciated!! Thanks!

1 answer

✓ Accepted answer
local ToolSpot = script.Parent.Parent.ToolSpot
script.Parent.ProximityPrompt.Triggered:Connect(function(player)
	local tool=player.Character:FindFirstChildOfClass"Tool"
	if not tool then return end
	tool.Parent,tool.Handle.Position = workspace,ToolSpot.Position
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.