helloburp
|
  |
| Joined: 26 Aug 2011 |
| Total Posts: 14376 |
|
|
| 05 Jan 2016 06:05 PM |
When I'm trying to modify a custom chat gui to fit my needs, the good ol' drunk roblox engine comes in and helps me
Client Script
-- ScriptGuider's custom chat template -- Try messing around with this and maybe make build your own chat from this
--\\ Services -- I always prefer GetService local RepStorage = game:GetService'ReplicatedStorage' local Players = game:GetService'Players' local StarterGui = game:GetService'StarterGui'
--\\ Remotes -- Using "WaitForChild" in case this script loads before the event does local ChatEvent = RepStorage:WaitForChild'ChatRemote'
--\\ Client stuff local Client = Players.LocalPlayer local Mouse = Client:GetMouse()
--\\ GUIs local Chatbar = script.Parent local ChatFrame = Chatbar.Parent.Frame
--\\ Chat messages local Chats = {}
--\\ Push messages local function PushMessages(Size) for i,v in pairs(Chats)do -- Iterate the "Chats" table which holds all the text labels v.Position = v.Position - UDim2.new(0,0,0,Size) if v.Position.Y.Offset < -ChatFrame.AbsoluteSize.Y then Chats[i] = nil -- Remove the value from the table v:Destroy() -- Destroy the text label end end end
--\\ Create message local function CreateMessage(Message, Speaker, SentPlayer) local Label = Instance.new("TextLabel") Label.BackgroundTransparency = 1 Label.TextXAlignment = "Left" Label.TextColor3 = SentPlayer.PlayerGui.ElementColor.Value Label.Font = "ArialBold" Label.FontSize = "Size12" Label.TextStrokeTransparency = 0 Label.Size = UDim2.new(1,0,0,16) Label.Position = UDim2.new(0,0,1,-13) if SentPlayer.leaderstats.Element.Value ~= "-" then Label.Text = tostring(Speaker).." (".. SentPlayer.leaderstats.Element.Value .."): "..Message else Label.Text = tostring(Speaker).." (DEAD): "..Message end PushMessages(Label.Size.Y.Offset) Chats[#Chats+1] = Label Label.Parent = ChatFrame end
Mouse.KeyDown:connect(function(Key) if Key:byte() == 47 then Chatbar:CaptureFocus() end end)
Chatbar.FocusLost:connect(function(Enter) if Enter then if Chatbar.Text == '' then return end ChatEvent:FireServer("chat",Chatbar.Text,Client) Chatbar.Text = '' end end)
ChatEvent.OnClientEvent:connect(function(Request, Message, Speaker, SentPlayer) Request = Request:lower() if Request == "chat" then CreateMessage(Message, Speaker, SentPlayer) end end)
-- Get rid of that old chat StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat, false) StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Health, false) StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
Server Script:
--\\ Services local RepStorage = game:GetService'ReplicatedStorage'
--\\ Remotes local ChatEvent = RepStorage:WaitForChild'ChatRemote'
--\\ Remote event ChatEvent.OnServerEvent:connect(function(Client, Request, Value, SentPlayer) Request = Request:lower() if Request == "chat" then -- Fire all clients will fire every client that has the "OnClientInvoke" event connected. (in this case, all clients) ChatEvent:FireAllClients("chat",Value,Client.Name, SentPlayer) end end)
Apperantly, PlayerGui is not a member of SentPlayer. The error occurs on this line.
Label.TextColor3 = SentPlayer.PlayerGui.ElementColor.Value
Go home engine, you're drunk. And now I have to find a work around. |
|
|
| Report Abuse |
|
Klink45
|
  |
| Joined: 06 Jun 2011 |
| Total Posts: 26054 |
|
|
| 05 Jan 2016 06:07 PM |
Are you just adding // at the beginning of your comments to look like C++ or some other language?
u sicko! http://www.roblox.com/u-sicko-item?id=328185093 |
|
|
| Report Abuse |
|
helloburp
|
  |
| Joined: 26 Aug 2011 |
| Total Posts: 14376 |
|
|
| 05 Jan 2016 06:07 PM |
| They were there before, as I said this is a modified script |
|
|
| Report Abuse |
|
| |
helloburp
|
  |
| Joined: 26 Aug 2011 |
| Total Posts: 14376 |
|
|
| 05 Jan 2016 06:18 PM |
| tried that earlier. removed the error being displayed, but the chat only appears on the client, not other player's screens |
|
|
| Report Abuse |
|
icanxlr8
|
  |
| Joined: 25 Feb 2009 |
| Total Posts: 3686 |
|
|
| 05 Jan 2016 06:40 PM |
Mouse.KeyDown is deprecated; try using UserInputService
Rock on! http://www.roblox.com/games/121584089/Rock-Roleplay |
|
|
| Report Abuse |
|