Mryeetmemes

UnitPlaceScript

Dec 9th, 2021
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.18 KB | None | 0 0
  1. local Player = game.Players.LocalPlayer
  2. local Mouse = Player:GetMouse()
  3. local Remote = game.ReplicatedStorage["ReplicatedStorage_CLOUD"].UnitControls.PlaceUnit
  4.  
  5. local Triggerd = false
  6. local Trigger = 0
  7.  
  8. local UIS = game:GetService("UserInputService")
  9. local GuiService = game:GetService("GuiService")
  10.  
  11. function placeUnit()
  12.     if script.Parent.Configuration.UnitEditor.Value == true then
  13.         Remote:FireServer(script.Parent.Configuration.UnitChoosed.Value, Mouse.hit, script.Parent.Configuration.UnitOrientation.Value, script.Parent.Configuration.UnitPlaceable.Value)
  14.         script.Parent.Configuration.UnitEditor.Value = false
  15.     end
  16. end
  17.  
  18. Mouse.Button1Down:Connect(function()
  19.     if UIS.TouchEnabled and not UIS.KeyboardEnabled and not UIS.MouseEnabled and not UIS.GamepadEnabled and not GuiService:IsTenFootInterface() then
  20.         if Trigger == 1 then
  21.             Trigger = 0
  22.             placeUnit()
  23.             Triggerd = true
  24.         else
  25.             Trigger = 1
  26.             Triggerd = false
  27.         end
  28.     else
  29.         placeUnit()
  30.     end
  31. end)
  32.  
  33. while wait() do
  34.     if Trigger == 1 then
  35.         if Triggerd == false then
  36.             wait(2)
  37.             if Trigger == 1 then
  38.                 if Triggerd == false then
  39.                     Triggerd = false
  40.                     Trigger = 0
  41.                 end
  42.             end
  43.         end
  44.     end
  45. end
Advertisement
Add Comment
Please, Sign In to add comment