I have made a path tool for r15, and now it works, but suddenly it stop working, not re-equip does nothing, it seems just stop working

local player = game:GetService("Players").LocalPlayer -- Getting the player
local mouse = player:GetMouse() -- Getting the mouse

function onMouseLeftButtonDown(mouse)
		print("---sel--mdown1-")
		print(sel)
		print("*************")
		sel = true
		print("---sel--mdown2-")
		print(sel)
		print("*************")
		if sel == true then	
			local p = Instance.new("Part")
			p.BrickColor = BrickColor.new("Bright blue")	
			p.Size=Vector3.new(3,1,5)
			p.Parent = game.Workspace
		
			p.Transparency = 0.7
			p.CanCollide = true
		
			--p.Name = "Player"..player.Name
			p.Name = "Ice"
			p.Anchored = true
		
			p.TopSurface = "Smooth"
			p.BottomSurface = "Smooth"
			
			
			local point = mouse.Hit.p
		
		
			local c = script.CleanUp:clone()
			c.Disabled = false
			c.Parent = p
			p.CFrame = CFrame.new(player.Character.Head.Position)
			p.CFrame = CFrame.new(player.Character.UpperTorso.Position.x,player.Character.UpperTorso.Position.y-4,player.Character.UpperTorso.Position.z)
			p.CFrame = CFrame.new(p.Position,point)
			local r = Instance.new("ObjectValue")
			r.Value = script.Parent.Parent.Parent
			r.Parent = p
			r.Name = "creator"
			wait()
			wait()
			wait()

			press(mouse)
		end
end

function press(mouse)
	print("---sel--pfunc-")
	print(sel)
	print("*************")
	if sel == true then
		local hit = mouse.Target
		local point = mouse.Hit.p
		
		
		local p = Instance.new("Part")
		p.BrickColor = BrickColor.new("Bright blue")	
		p.Size=Vector3.new(3,1,5)
		p.Parent = game.Workspace
		
		p.Transparency = 0.7
		p.CanCollide = true
		
		--p.Name = "Player"..player.Name
		p.Name = "Ice"
		p.Anchored = true
		
		p.TopSurface = "Smooth"
		p.BottomSurface = "Smooth"
		
		
		local c = script.CleanUp:clone()
		c.Disabled = false
		c.Parent = p
		p.CFrame = CFrame.new(player.Character.Head.Position)
		p.CFrame = CFrame.new(player.Character.UpperTorso.Position.x,player.Character.UpperTorso.Position.y-4,player.Character.UpperTorso.Position.z)
		p.CFrame = CFrame.new(p.Position,point)
		local r = Instance.new("ObjectValue")
		r.Value = script.Parent.Parent.Parent
		r.Parent = p
		r.Name = "creator"
		wait()
		wait()
		wait()
		press(mouse)
	end
end

function onKeyDown(key,mouse) 
	key:lower() --make input lower
	
	if key == "r" then
		print("r press")
		local e = game.Workspace:GetChildren()
		for i=1,#e do
			if e[i].className == "Part" and 
			  	e[i].Name == "Ice" and
		  		e[i]:findFirstChild("creator")~=nil and
		  		e[i].creator.Value == script.Parent.Parent.Parent then
		  		e[i]:remove()
			end 
		end
	elseif key == "n" then
		print("n press")
		local e = game.Workspace:GetChildren()
		for i=1,#e do
			if e[i].className == "Part" then
				if e[i].Name == "Ice" then
					e[i]:remove()
				end 
			end 
		end 
	end
	end
	
function onButton1Up(mouse)
	sel = false
	print("---sel--mup-")
	print(sel)
	print("*************")
end


function onEquippedLocal(mouse)

	--if mouse == nil then
		--print("Mouse not found")
		--return 
	--end
	
	if mouse ~= nil then
		mouse.Icon = "http://www.roblox.com/asset/?id=2198150525"
		mouse.Button1Down:connect(function() onMouseLeftButtonDown(mouse) end)
		mouse.Button1Up:connect(function() onButton1Up(mouse) end)
		mouse.KeyDown:connect(onKeyDown)
	end
end
	


function unSelect(mouse)
	sel = false
	print("---sel---uneq")
	print(sel)
	print("*************")
end

script.Parent.Equipped:connect(onEquippedLocal) 
script.Parent.Unequipped:connect(unSelect)

My debug print gives me nothing at all, so it seem stop working completylty??? What do to do?

It just stop working, why? it work to a start, then it stops?

1 comment

0

Don't post free model code.