Advertisement
Sungmingamerpro13

DialogueScript

Apr 15th, 2024
1,947
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CSS 1.37 KB | None | 0 0
  1. local camera = Instance.new("Camera", script.Parent)
  2. local Message = game.ReplicatedStorage:WaitForChild("Message")
  3. local Speaker = Message:WaitForChild("Speaker")
  4.  
  5. local player = game.Players.LocalPlayer
  6. local DialogueFrame = player.PlayerGui:WaitForChild("DialogueGui").DialogueFrame
  7.  
  8. function UpdaterCharacter(character)
  9.     for i, v in pairs(DialogueFrame.Icon.Character:GetDescendants()) do
  10.         v:Destroy()
  11.     end
  12.     for i, v in pairs(character:GetChildren()) do
  13.         if v:IsA("BasePart") or v:IsA("Accessory") or v:IsA("Shirt") or v:IsA("Pants") or v:IsA("ShirtGraphic") or v:IsA("BodyColors") or v:IsA("Humanoid") then
  14.             local new = v:Clone()
  15.             new.Parent = DialogueFrame.Icon.Character
  16.             if v:IsA("Humanoid") then
  17.                 new.DisplayDistanceType = Enum.HumanoidDisplayDistanceType.None
  18.             end
  19.         end
  20.     end
  21.     DialogueFrame.Icon.CurrentCamera = camera
  22.     camera.CFrame = character.PrimaryPart.CFrame * CFrame.new(0, 1.5, -2) * CFrame.Angles(0, math.rad(180), 0)
  23. end
  24.  
  25. Message:GetPropertyChangedSignal("Value"):Connect(function()
  26.     if Message.Value == "None" then
  27.         DialogueFrame.Visible = false
  28.     else
  29.         DialogueFrame.Visible = true
  30.     end
  31.     DialogueFrame.TextLabel.Text = Message.Value
  32.     script.DialogueSound:Play()
  33. end)
  34.  
  35. Speaker:GetPropertyChangedSignal("Value"):Connect(function()
  36.     UpdaterCharacter(workspace[Speaker.Value])
  37.     DialogueFrame.Icon.nameLabel.Text = Speaker.Value
  38. end)
  39.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement