So I am making a tool that puts a meatloaf where you click however when you stop clicking the function still continues please help!
Code:
local tool = script.Parent
local IsE = 0
local IsC = 0
local mouse = game.Players.LocalPlayer:GetMouse()
local laser = game.ServerStorage.Laser
function onClicked(mouse)
local mouse = game.Players.LocalPlayer:GetMouse()
tool.Fire1.BrickColor=BrickColor.Red()
laser.Parent=workspace
while true do
game.Workspace.MeatLoaf.Position=mouse.Hit.p
wait(0.1)
end
end
function Equipped(mouse)
mouse.Button1Down:connect(onClicked)
end
tool.Equipped:connect(Equipped)
function offClicked(mouse)
tool.Fire1.BrickColor=BrickColor.Black()
end
mouse.Button1Up:connect(offClicked)

1 comment
You use a while true do, this can only be canceled by inserting a break.