Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local hopperbin = Instance.new("HopperBin")
- hopperbin.Name = "Rainbow Path"
- hopperbin.Parent = game.Players.LocalPlayer.Backpack
- bin = script.Parent
- function onKeyDown(key,mouse)
- key:lower()
- if key == "r" then
- e = game.Workspace:GetChildren()
- for i=1,#e do
- if e[i].className == "Part" then
- if e[i].Name == "Ice" then
- if e[i]:findFirstChild("creator")~=nil then
- if e[i].creator.Value == script.Parent.Parent.Parent then
- e[i]:remove()
- end
- end
- end
- end
- end
- elseif key == "n" then
- 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 press(mouse)
- if sel == true then
- hit = mouse.Target
- local point = mouse.Hit.p
- s = Instance.new("Part")
- s.CanCollide = true
- s.Size=Vector3.new(6,2,18)
- s.Anchored = true
- s.Color = Color3.new(math.random(),math.random(),math.random())
- s.Transparency = 0.3
- s.Name = "Ice"
- s.TopSurface = "Smooth"
- s.BottomSurface = "Smooth"
- s.Parent = game.Workspace
- c = script.CleanUp:clone()
- c.Disabled = false
- c.Parent = s
- s.CFrame = CFrame.new(script.Parent.Parent.Parent.Character.Head.Position)
- s.CFrame = CFrame.new(script.Parent.Parent.Parent.Character.Torso.Position.x,script.Parent.Parent.Parent.Character.Torso.Position.y-4,script.Parent.Parent.Parent.Character.Torso.Position.z)
- s.CFrame = CFrame.new(s.Position,point)
- r = Instance.new("ObjectValue")
- r.Value = script.Parent.Parent.Parent
- r.Parent = s
- r.Name = "creator"
- wait()
- press(mouse)
- end
- end
- function onButton1Down(mouse)
- sel = true
- if sel == true then
- hit = mouse.Target
- local point = mouse.Hit.p
- s = Instance.new("Part")
- s.CanCollide = true
- s.Size=Vector3.new(5,2,17)
- s.Anchored = true
- s.Color = Color3.new(math.random(),math.random(),math.random())
- s.Transparency = 0.3
- s.Name = "Ice"
- s.TopSurface = "Smooth"
- s.BottomSurface = "Smooth"
- s.Parent = game.Workspace
- c = script.CleanUp:clone()
- c.Disabled = false
- c.Parent = s
- s.CFrame = CFrame.new(script.Parent.Parent.Parent.Character.Head.Position)
- s.CFrame = CFrame.new(script.Parent.Parent.Parent.Character.Torso.Position.x,script.Parent.Parent.Parent.Character.Torso.Position.y-5,script.Parent.Parent.Parent.Character.Torso.Position.z)
- s.CFrame = CFrame.new(s.Position,point)
- r = Instance.new("ObjectValue")
- r.Value = script.Parent.Parent.Parent
- r.Parent = s
- r.Name = "creator"
- wait()
- hit = mouse.Target
- local point = mouse.Hit.p
- s = Instance.new("Part")
- s.CanCollide = true
- s.Size=Vector3.new(5,2,17)
- s.Anchored = true
- s.Color = Color3.new(math.random(),math.random(),math.random())
- s.Transparency = 0.3
- s.Name = "Ice"
- s.TopSurface = "Smooth"
- s.BottomSurface = "Smooth"
- s.Parent = game.Workspace
- c = script.CleanUp:clone()
- c.Disabled = false
- c.Parent = s
- s.CFrame = CFrame.new(script.Parent.Parent.Parent.Character.Head.Position)
- s.CFrame = CFrame.new(script.Parent.Parent.Parent.Character.Torso.Position.x,script.Parent.Parent.Parent.Character.Torso.Position.y-4,script.Parent.Parent.Parent.Character.Torso.Position.z)
- s.CFrame = CFrame.new(s.Position,point)
- r = Instance.new("ObjectValue")
- r.Value = script.Parent.Parent.Parent
- r.Parent = s
- r.Name = "creator"
- wait()
- hit = mouse.Target
- local point = mouse.Hit.p
- s = Instance.new("Part")
- s.CanCollide = true
- s.Size=Vector3.new(5,2,15)
- s.Anchored = true
- s.Color = Color3.new(math.random(),math.random(),math.random())
- s.Transparency = 0.3
- s.Name = "Ice"
- s.TopSurface = "Smooth"
- s.BottomSurface = "Smooth"
- s.Parent = game.Workspace
- c = script.CleanUp:clone()
- c.Disabled = false
- c.Parent = s
- s.CFrame = CFrame.new(script.Parent.Parent.Parent.Character.Head.Position)
- s.CFrame = CFrame.new(script.Parent.Parent.Parent.Character.Torso.Position.x,script.Parent.Parent.Parent.Character.Torso.Position.y-6,script.Parent.Parent.Parent.Character.Torso.Position.z)
- s.CFrame = CFrame.new(s.Position,point)
- r = Instance.new("ObjectValue")
- r.Value = script.Parent.Parent.Parent
- r.Parent = s
- r.Name = "creator"
- press(mouse)
- end
- end
- function onButton1Up(mouse)
- sel = false
- end
- function onEquippedLocal(mouse)
- if mouse == nil then
- print("Mouse not found")
- return
- end
- mouse.Icon = "rbxasset://textures\\GunCursor.png"
- mouse.Button1Down:connect(function() onButton1Down(mouse) end)
- mouse.Button1Up:connect(function() onButton1Up(mouse) end)
- mouse.KeyDown:connect(onKeyDown)
- e = script.Parent.Parent.Parent:GetChildren()
- for i=1,#e do
- if e[i].className == "Hint" then
- e[i]:remove()
- end
- end
- s = Instance.new("Hint")
- s.Parent = script.Parent.Parent.Parent
- s.Text = "Hold your mouse button down to create a Rainbow Path in front of you. Press r to erase it all. Made by tbradm."
- end
- function unsel(mouse)
- e = script.Parent.Parent.Parent:GetChildren()
- for i=1,#e do
- if e[i].className == "Hint" then
- e[i]:remove()
- end
- end
- end
- hopperbin.Selected:connect(onEquippedLocal)
- hopperbin.Deselected:connect(unsel)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement