Advertisement
rrixh

kollision toggle

Sep 18th, 2023 (edited)
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.38 KB | None | 0 0
  1. local UserInputService = game:GetService("UserInputService")
  2.  
  3. local function KollisionToggler()
  4.     local MouseTarget = game.Players.LocalPlayer:GetMouse().Target
  5.     MouseTarget.CanCollide = not MouseTarget.CanCollide
  6.     if MouseTarget.CanCollide then
  7.         MouseTarget.Transparency = 0
  8.     else
  9.         MouseTarget.Transparency = 0.7
  10.     end
  11. end
  12.  
  13. UserInputService.InputBegan:Connect(function(Key, Typing)
  14.     if not Typing then
  15.         local key = Key.KeyCode.Name
  16.         if key == "K" then
  17.             KollisionToggler()
  18.         end
  19.     end
  20. end)
  21.  
  22. local function createNotification(message)
  23.     local Notification = Instance.new("ScreenGui")
  24.     Notification.Name = "Notification"
  25.     Notification.Parent = game.Players.LocalPlayer.PlayerGui
  26.  
  27.     local Frame = Instance.new("Frame")
  28.     Frame.Size = UDim2.new(0, 0, 0, 0)
  29.     Frame.Position = UDim2.new(0.5, -100, 0, 10)
  30.     Frame.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
  31.     Frame.BorderSizePixel = 0
  32.     Frame.Parent = Notification
  33.  
  34.     local TextLabel = Instance.new("TextLabel")
  35.     TextLabel.Size = UDim2.new(1, 0, 1, 0)
  36.     TextLabel.BackgroundTransparency = 1
  37.     TextLabel.Text = message
  38.     TextLabel.TextColor3 = Color3.fromRGB(0, 0, 0)
  39.     TextLabel.TextSize = 20
  40.     TextLabel.Parent = Frame
  41.  
  42.     wait(5)
  43.  
  44.     Notification:Destroy()
  45. end
  46.  
  47.  
  48. createNotification("Press K to toggle kollision")
  49.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement