Source (local)
local lplr = game.Players.LocalPlayer
local mouse = lplr:GetMouse()
local cc = workspace.CurrentCamera
local sM : Enum.Material
local m = 3
local disval = Instance.new('NumberValue')
local cnt : RBXScriptConnection
local auth = game.ReplicatedStorage.AuthorizeNodeControl
local cnode
local bMouse = lplr.PlayerGui:WaitForChild('extra').bMouse
local savedo = Vector3.new(0,0,0)
local tatt = Instance.new('Attachment') tatt.Parent = workspace.Baseplate tatt.Name = 'tatt'
mouse.WheelForward:Connect(function()
if cnode then
if m < 5.8 then
m+= .2
end
end
end)
mouse.WheelBackward:Connect(function()
if cnode then
if m > .8 then
m-= .2
end
end
end)
mouse.Move:Connect(function()
if not cnode and mouse.Target then
if mouse.Target.Parent == workspace.nodes then
if mouse.Target.OwnerId.Value == lplr.UserId then
bMouse.Visible = true
bMouse.Position = UDim2.fromOffset(mouse.X,mouse.Y)
return
end
end
end
bMouse.Visible = false
end)
local correct = function()
local targetvec = mouse.Origin + mouse.Origin.LookVector*m
local curvec = cnode.CFrame
local dis = (curvec.Position-targetvec.Position).Magnitude
local angle = CFrame.lookAt(curvec.Position,targetvec.Position)
local line = workspace:FindFirstChild('line') or Instance.new('Part')
local cpos = lplr.Character:WaitForChild('RightHand').CFrame
line.Name = 'line'
line.CanCollide = false line.Anchored = true line.Size = Vector3.new(.1,.1,(cpos.Position-curvec.Position).Magnitude)
line.Transparency = .6
line.CFrame =
CFrame.lookAt(
curvec.Position,cpos.Position) +
(
CFrame.lookAt(curvec.Position,cpos.Position).LookVector *
(cpos.Position-curvec.Position).Magnitude)/2
line.Parent = workspace
local sval = angle.LookVector*dis*m
if dis < .1 then sval = Vector3.new(0,0,0) end
cnode.Attachment.LinearVelocity.VectorVelocity = sval
end
mouse.Button1Down:Connect(function()
local tnode = mouse.Target
if tnode then
if tnode.Parent == workspace.nodes then
if auth:InvokeServer(tnode) then
tatt.Orientation = tnode.Orientation
local newt = Instance.new('AlignOrientation')
newt.Parent = tnode newt.Name = 'newt'
newt.Enabled = true newt.Attachment0 = tnode.Attachment newt.Attachment1 = tatt
tnode.Transparency = .5
sM = tnode.Material
tnode.Material = Enum.Material.Neon
tnode.Attachment.LinearVelocity.Enabled = true
cnt = game["Run Service"].RenderStepped:Connect(correct)
cnode = tnode
end
end
end
end)
mouse.Button1Up:Connect(function()
if cnode then
-- Sets the client's view of the model back to regular.
cnode.Transparency = 0
cnode.Material = sM
cnode.AssemblyAngularVelocity = Vector3.new(0,0,0)
cnt:Disconnect()
cnode.Attachment.LinearVelocity.VectorVelocity = Vector3.new(0,0,0)
cnode.Attachment.LinearVelocity.Enabled = false
cnode.newt:Destroy()
if workspace:WaitForChild('line') then workspace:WaitForChild('line'):Destroy() end
cnode = nil
end
end)
what solutions are there to prevent this?