Advertisement
scriptingtales

LSB Roblox Part on Camera Position

Mar 27th, 2024 (edited)
475
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.96 KB | None | 0 0
  1.     local remote = Instance.new("RemoteEvent")
  2.     remote.Name = "cam"
  3.     remote.Parent = owner.PlayerGui
  4.  
  5.     NLS([[
  6.     local cam = workspace.CurrentCamera
  7.     local remote = owner.PlayerGui:FindFirstChild("cam")
  8.     game:GetService("RunService").PreRender:Connect(function()
  9.         remote:FireServer(cam.CFrame)
  10.     end)
  11.     ]])
  12.  
  13.     local camCF = CFrame.new()
  14.     remote.OnServerEvent:Connect(function(plr, cf)
  15.         camCF = cf
  16.     end)
  17.  
  18.     local part = Instance.new("Part")
  19.     local decal = Instance.new("Decal", part)
  20.     decal.Texture = "rbxassetid://11346388439"
  21.     part.Anchored = true
  22.     part.CanCollide = false
  23.     part.Parent = script
  24.     part.Size = Vector3.new(3, 3, 3)
  25.  
  26.  
  27.     local Billboard = Instance.new("BillboardGui", part)
  28.     local textLabel = Instance.new("TextLabel", Billboard)
  29.  
  30.  
  31.     Billboard.StudsOffset = Vector3.new(0, 6, 0)
  32.     Billboard.MaxDistance = math.huge
  33.  
  34.     Billboard.Size = UDim2.new(0, 200, 0, 50)
  35.  
  36.     textLabel.TextStrokeColor3 = Color3.fromRGB(255, 255, 255)
  37.     textLabel.TextStrokeTransparency = 0 textLabel.BackgroundTransparency = 1
  38.     textLabel.TextScaled = true
  39.     textLabel.Text = owner.DisplayName .. "'s (@".. owner.Name ..")".. " camera"
  40.     textLabel.Size = UDim2.new(1, 0, 1, 0)
  41.     Billboard.LightInfluence = 0
  42.  
  43.  
  44.  
  45.     local billboard = Instance.new("BillboardGui", part)
  46.     local textLabel = Instance.new("TextBox", billboard)
  47.  
  48.     textLabel.Visible = false
  49.     textLabel.Size = UDim2.new(5, 0, 1, 0)
  50.     textLabel.BackgroundTransparency = 0
  51.     textLabel.Font = Enum.Font.Arcade
  52.     textLabel.TextScaled = true
  53.     textLabel.BackgroundColor3 = Color3.new(1, 1, 1)
  54.     textLabel.BorderSizePixel = 5
  55.     textLabel.BorderColor3 = Color3.new(1, 1, 1)
  56.     textLabel.TextColor3 = Color3.new(0, 0, 0)
  57.  
  58.     billboard.Adornee = part
  59.     billboard.Size = UDim2.new(2, 0, 2, 0)
  60.     billboard.StudsOffset = Vector3.new(-4, 5, 0)
  61.     billboard.ExtentsOffset = Vector3.new(0,3,0)
  62.     billboard.LightInfluence = 0
  63.  
  64.     owner.Chatted:Connect(function(msg)
  65.         textLabel.Visible = true
  66.         for txt = 1, #msg do
  67.             textLabel.Text = string.sub(msg, 1, txt)
  68.         end
  69.         wait(20)
  70.         textLabel.Visible = false
  71.     end)
  72.  
  73.  
  74.  
  75.  
  76.     game:GetService("RunService").Heartbeat:Connect(function()
  77.     part.CFrame = camCF
  78.    
  79.     if part then
  80.     else
  81.         local part = Instance.new("Part")
  82.         local decal = Instance.new("Decal", part)
  83.         decal.Texture = "rbxassetid://11346388439"
  84.         part.Anchored = true
  85.         part.CanCollide = false
  86.         part.Parent = script
  87.         part.Size = Vector3.new(3, 3, 3)
  88.  
  89.  
  90.         local Billboard = Instance.new("BillboardGui", part)
  91.         local textLabel = Instance.new("TextLabel", Billboard)
  92.  
  93.  
  94.         Billboard.StudsOffset = Vector3.new(0, 6, 0)
  95.         Billboard.MaxDistance = math.huge
  96.  
  97.         Billboard.Size = UDim2.new(0, 200, 0, 50)
  98.  
  99.         textLabel.TextStrokeColor3 = Color3.fromRGB(255, 255, 255)
  100.         textLabel.TextStrokeTransparency = 0 textLabel.BackgroundTransparency = 1
  101.         textLabel.TextScaled = true
  102.         textLabel.Text = owner.DisplayName .. "'s (@".. owner.Name ..")".. " camera"
  103.         textLabel.Size = UDim2.new(1, 0, 1, 0)
  104.         Billboard.LightInfluence = 0
  105.     end
  106.    
  107.     end)
  108.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement