Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local player = game.Players.LocalPlayer
- local mouse = player:GetMouse()
- local Grid = game.Workspace.Grid
- local GridSize = (4/2)
- local Offset = .2
- local Marker = game.Workspace.Marker
- local PosX = Marker.CFrame.X
- local PosY = Marker.CFrame.Y
- local PosZ = Marker.CFrame.Z
- mouse.Move:Connect(function()
- if mouse.Target == Grid then
- mouse.TargetFilter = game.Workspace.Marker
- Marker.Position = Vector3.new((math.floor(mouse.Hit.X / GridSize +.5 ) * GridSize) - .575, mouse.Hit.Y, (math.floor(mouse.Hit.Z / GridSize + .5) * GridSize) )
- end
- end)
- local Done = false
- local part
- local OldMarker
- mouse.Button1Down:Connect(function()
- if not Done then
- OldMarker = Marker:Clone()
- OldMarker.Parent = game.Workspace
- OldMarker.CFrame = Marker.CFrame
- part = Instance.new("Part")
- part.Size = Vector3.new(.1,Grid.Size.Y,.1)
- part.Anchored = true
- part.Position = Marker.Position
- part.TopSurface = Enum.SurfaceType.Smooth
- part.Parent = game.Workspace
- mouse.TargetFilter = part
- Done = true
- elseif Done then
- Done = false
- OldMarker:Destroy()
- end
- end)
- local Midpoint = function(x1, x2)
- local Answer = ((x2 + x1)/2)
- return Answer
- end
- mouse.Button1Up:Connect(function()
- wait()
- spawn(function()
- while Done do
- part.Size = Vector3.new(math.abs((Marker.Position.X - OldMarker.Position.X)), .1, math.abs((Marker.Position.Z - OldMarker.Position.Z)))
- part.CFrame = CFrame.new(Midpoint(OldMarker.CFrame.X, Marker.CFrame.X), part.Position.Y, Midpoint(OldMarker.CFrame.Z, Marker.CFrame.Z))
- wait()
- end
- end)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement