Schupp

Untitled

Sep 24th, 2021
852
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local part = nil
  2. local dwn = false
  3. local mouse_fd = Instance.new("Folder",script)
  4. mouse_fd.Name = "Mouse"
  5. local m1d,m1u,kd,updateposition = Instance.new("RemoteEvent",mouse_fd), Instance.new("RemoteEvent",mouse_fd), Instance.new("RemoteEvent",mouse_fd), Instance.new("RemoteEvent",mouse_fd)
  6. m1d.Name = "Button1Down"
  7. m1u.Name = "Button1Up"
  8. kd.Name = "KeyDown"
  9. updateposition.Name = "Update_Hit_Target"
  10. local mouse = {
  11.     ["Button1Down"]=m1d.OnServerEvent,
  12.     ["Button1Up"]=m1u.OnServerEvent,
  13.     ["KeyDown"]=kd.OnServerEvent,
  14.     Hit = CFrame.new(0,0,0),
  15.     Target = nil
  16. }
  17. NLS([====[
  18.     local UpdateMouse = script.Parent.Mouse.Update_Hit_Target
  19.     local M1Down = script.Parent.Mouse.Button1Down
  20.     local M1Up = script.Parent.Mouse.Button1Up
  21.     Local KDown = script.Parent.Mouse.KeyDown
  22.  
  23.     local mouse = owner:GetMouse()
  24.     local lasthit,lasttarget = mouse.Hit,mouse.Target
  25.     mouse.Keydown:Connect(function(k)
  26.         KDown:FireServer(k)
  27.     end)
  28.     game:GetService("RunService").Heartbeat:Connect(function()
  29.         if mouse.Hit ~= lasthit or mouse.Target ~=lasttarget then
  30.             UpdateMouse:FireServer(mouse.Hit,mouse.Target)
  31.         end
  32.     end)
  33. ]====],script)
  34. updateposition.OnServerEvent:Connect(function(plr,hit,target)
  35.     if plr ~= owner then
  36.         return
  37.     end
  38.     mouse.hit = hit
  39.     mouse.Hit = hit
  40.     mouse.target = target
  41.     mouse.Target = target
  42. end)
  43. mouse.KeyDown:Connect(function(plr,k)
  44.     if plr ~= owner then
  45.         return
  46.     end
  47.     if k == "t" and part ~= nil then
  48.         local clone = part:Clone()
  49.         clone.Parent = workspace
  50.         clone.Anchored = false
  51.         clone:ClearAllChildren()
  52.         clone.CanCollide = true
  53.         bp.Parent = clone
  54.         particles.Parent = clone
  55.         if part.Parent:FindFirstChildOfClass("Humanoid") then
  56.             part.Parent:FindFirstChildOfClass("Humanoid").PlatformStand = false
  57.         end
  58.         part:Destroy()
  59.         part = clone
  60.     end
  61. end)
  62.  
  63. mouse.Button1Down:Connect(function(plr,mouse)
  64.     if plr ~= owner then
  65.         return
  66.     end
  67.     if mouse ~= nil then
  68.         if mouse.Target ~= nil then
  69.             part = mouse.Target
  70.             bp = Instance.new("BodyPosition",part)
  71.             bp.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
  72.             bp.Position = part.Position
  73.             dwn = true
  74.         end
  75.     end
  76.     while dwn do
  77.         game:GetService("RunService").Stepped:Wait()
  78.         bp.Position = mouse.Hit.p
  79.         if part then
  80.             if part.Parent:FindFirstChildOfClass("Humanoid") then
  81.                 part.Parent:FindFirstChildOfClass("Humanoid").PlatformStand = true
  82.             end
  83.         end
  84.     end
  85. end)
  86.  
  87. mouse.Button1Up:Connect(function(plr,mouse)
  88.     if plr ~= owner then
  89.         return
  90.     end
  91.     dwn = false
  92.     if part then
  93.         if part.Parent:FindFirstChildOfClass("Humanoid") then
  94.             part.Parent:FindFirstChildOfClass("Humanoid").PlatformStand = false
  95.         end
  96.         part = nil
  97.     end
  98.     if bp then
  99.         bp:Destroy()
  100.     end
  101.     if particles then
  102.         particles:Destroy()
  103.     end
  104. end)
  105. print("Ready!")
RAW Paste Data