local platform = workspace.Platform
local part = workspace.TestItem:WaitForChild("Part")
local touching = false
local UserInputService = game:GetService("UserInputService")
-- Track when the part touches the platform
part.Touched:Connect(function(hit)
if hit == platform then
print("Test")
touching = true
end
end)
-- Track when the part stops touching the platform
part.TouchEnded:Connect(function(hit)
if hit == platform then
touching = false
end
end)
-- Track key press (Z key specifically)
UserInputService.InputBegan:Connect(function(input, gameProcessed)
if not gameProcessed and input.UserInputType == Enum.UserInputType.Keyboard then
if touching and input.KeyCode == Enum.KeyCode.Z then
print("Welded Successfully")
end
end
end)
Why it doesn't even print "Welded" for me
** You are now Level 7! **