generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: The drunk roblox engine strikes again

Previous Thread :: Next Thread 
helloburp is not online. 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 is not online. 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 is not online. 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
rowerowe71 is not online. rowerowe71
Joined: 14 Apr 2013
Total Posts: 1999
05 Jan 2016 06:14 PM
add a waitforchild
Report Abuse
helloburp is not online. 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 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image