Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Players = (game.Players);
- local Player = (Players.LocalPlayer);
- local Character = (Player.Character);
- function TypeWriter(DebrisTime, String, BaseObj)
- --// Type Writer Effect
- --// Created by: Wubzer
- --// I found the "magic number" 0.58333 just through trial and error of finding the perfect dynamic factor.
- --// Destroy Extra Type Writer
- if (workspace:FindFirstChild(Player.Name .. "[TypeWriterText]")) then workspace[Player.Name .. "[TypeWriterText]"]:Destroy(); end;
- --// Variables
- local VectorUp = (CFrame.new(0, -3.5, 0));
- local TypePart = (Instance.new("Part", workspace));
- local TypeBill = (Instance.new("BillboardGui", TypePart));
- local TypeText = (Instance.new("TextLabel", TypeBill));
- local TypeWeld = (Instance.new("Weld", TypePart));
- --// TypePart
- TypePart.BrickColor = (BrickColor.new("Really black"));
- TypePart.Transparency = (1);
- TypePart.Name = (Player.Name .. "[TypeWriterText]");
- TypePart.CFrame = (BaseObj.CFrame)
- TypePart.Anchored = (false);
- TypePart.CanCollide = (false);
- TypePart.Size = (Vector3.new(1, 1, 1));
- --// TypeBill
- TypeBill.Name = ("TypeBill");
- TypeBill.Size = UDim2.new(string.len(String) * 0.58333, 0, 0.86, 0);
- --// TypeText
- TypeText.BackgroundTransparency = (1);
- TypeText.Name = ("TypeText");
- TypeText.Size = (UDim2.new(1, 0, 1, 0));
- TypeText.Font = (Enum.Font.Antique);
- TypeText.Text = ("");
- TypeText.TextColor3 = (Color3.new(0, 0, 0));
- TypeText.TextScaled = (true);
- TypeText.TextStrokeColor3 = (Color3.new(1, 0, 0));
- TypeText.TextStrokeTransparency = (0);
- --// TypeWeld
- TypeWeld.Part0 = (BaseObj);
- TypeWeld.Part1 = (TypePart);
- TypeWeld.C0 = (BaseObj.CFrame:inverse());
- TypeWeld.C1 = (BaseObj.CFrame:inverse() * VectorUp);
- --// Debris
- game.Debris:AddItem(TypePart, (DebrisTime + (string.len(String) * 0.05)));
- --// Change Text
- for i = 1, string.len(String) do
- if (not workspace:FindFirstChild(Player.Name .. "[TypeWriterText]")) then break; end;
- workspace:FindFirstChild(Player.Name .. "[TypeWriterText]").TypeBill.TypeText.Text = (string.sub(String, 1, i));
- wait(0.05);
- end;
- end;
- Player.Chatted:Connect(function(Msg)
- TypeWriter(7, Msg, Character.HumanoidRootPart);
- end);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement