When coding in ROBLOX Studio for things that will make your games look lots more stylish, you have your cookiez and milk next to you while coding a beautiful addition to your game. On this tutorial, I will create a chat gui, very simple, and can be modified however you wish. If you would like to edit this and do not know what to do, personal message me. (zakary99)
1. Write this in the command bar: Instance.new("ScreenGui", game.StarterGui).Name = "ChatGui" or add a new ScreenGui to StarterGui and name it 'ChatGui'.
2. Add this code to a script in the workspace:
game.Players.PlayerAdded:connect(function(player) -- Main two functions.
player.Chatted:connect(function(msg)
for _,v in pairs (game.Players:GetChildren()) do -- Gets all the players
for _,frame in pairs(v.PlayerGui.ChatGui:GetChildren()) do --Finds the chat children if there is one.
if frame:IsA("Frame") then-- Finds out if the chat's children is a frame
frame.Position = UDim2.new(frame.Position.X.Scale, 0, frame.Position.Y.Scale-0.05, 0) -- moves the frame up.
end
end
frame = Instance.new("Frame", v.PlayerGui.ChatGui)--Makes a new frame for the text.
frame.Size = UDim2.new(0.3, 0, 0.05, 0)--Chooses the main size.
frame.Position = UDim2.new(0, 0, 0.05, 0)--Gives the frame the correct position.
frame.Style = "RobloxRound" -- Makes the frame Roblox Round
frame.ClipDescendants = true -- Makes it so the text cannote escape the frame.
message=Instance.new("TextLabel", frame) -- Makes the message label.
message.Position = UDim2.new(0, 0, 0.5, 0) -- Chooses the correct position inside the frame.
message.TextXAlignment = "Left" -- Makes the text on a left alignment so it has a better length.
message.TextColor3 = BrickColor.new("White").Color --Chooses the color
message.Text = "["..player.Name.."]: "..msg -- Gets the message and player's name inside the message label.
message.FontSize = "Size18" -- gives the message's font size 18
message.Font = "Arial" -- A personal favourite
end
end)
end) -- Ends the functions.
Click here to take the model.
This is just a simple chat gui, you could integrate things like TweenPosition() method and Coroutines.
Thanks for reading,
Any questions? Tweet me @RBX_Zakary99, skype me: Zakary Wilson (hetrozakary), PM me (zakary99)
~Zakary Wilson
You made a mistake.
ReplyDeleteIt's ClipsDescendants, not ClipDescendant
.-. There is no mistake- it worked for me.
ReplyDeleteYour blog prevents copying text. This is a hindrance considering your posts contain code that people ought to be able to copy and paste into their scripts to try them out.
ReplyDeleteIf you write out the script it tends to make you learn better. But I do see your point Joel
ReplyDelete