Advertisement
The_Red

old cube script

Apr 16th, 2024
437
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.58 KB | None | 0 0
  1. local plr = game.Players.LocalPlayer
  2. local mouse = plr:GetMouse()
  3. local cas = game:GetService("ContextActionService")
  4. local multiplyfactor = 0.1
  5.  
  6. function click(actionName, inputState, inputObject, part)
  7.     if mouse and mouse.Target and mouse.Target:GetTags()[1] == "ScriptedPart" then
  8.         if inputState == Enum.UserInputState.Begin then
  9.             local part = mouse.Target
  10.             local points = math.random() * multiplyfactor
  11.             local rdmSize = Vector3.one * points
  12.             print(rdmSize)
  13.             print(points)
  14.             part.Size += rdmSize
  15.             part.Position = part.Position + Vector3.new(0,rdmSize.Y/2,0)
  16.             part.Highlight.FillColor = BrickColor.random().Color
  17.             part.Highlight.OutlineColor = BrickColor.random().Color
  18.             local increment = math.floor(points)
  19.             if increment <= 0 then
  20.                 increment += 1
  21.             end
  22.             game.ReplicatedStorage.IncrementPoints:FireServer(increment)
  23.         end
  24.     end
  25. end
  26.  
  27. game:GetService("RunService").RenderStepped:Connect(function()
  28.     if mouse and mouse.Target and mouse.Target:GetTags()[1] == "ScriptedPart" then
  29.         if not mouse.Target:FindFirstChild("Highlight") then
  30.             local higlight = Instance.new("Highlight",mouse.Target)
  31.             higlight.FillColor = BrickColor.random().Color
  32.             higlight.OutlineColor = BrickColor.random().Color
  33.         end
  34.         cas:BindAction("click",click,false,Enum.UserInputType.MouseButton1)
  35.     else
  36.         for i,v in workspace:GetChildren() do
  37.             if v:GetTags()[1] == "ScriptedPart" then
  38.                 for index,highlight in v:GetChildren() do
  39.                     if highlight:IsA("Highlight") then
  40.                         highlight:Destroy()
  41.                     end
  42.                 end
  43.             end
  44.         end
  45.         cas:UnbindAction("click")
  46.     end
  47. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement