Hello, thanks for clicking on my thread. I have an issue with this code that I thought would work but doesn't. What happens is that when grabbing the tool, I thought adding break would stop the spinning but nothing worked. Instead of breaking the loop like it should. It continues to rotate and starts spinning the player when equipped. Please help!
The script is located inside of a handle and the handle is in a tool.
Code:
local handle = script.Parent
handle.CanCollide = false
handle.Touched:Connect(function()
handle.Anchored = false
end)
while true do -- problem
if handle.Touched == true then
break
else
handle.CFrame = handle.CFrame * CFrame.fromEulerAnglesXYZ(0.1, 0.1, 0.1)
wait()
end
end

1 comment
When you say 'grabbing', do you mean equipping the tool? If so, you should use events like tool.Equipped. Wait how does handle spin when not equipped. Oh and maybe put break into the event handle.Touched, because the event and loop are waiting for same thing.