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: Odd error?

Previous Thread :: Next Thread 
McGunz is not online. McGunz
Joined: 26 Dec 2011
Total Posts: 759
01 Nov 2015 01:52 AM
Hey guys I have been trying to make something but always get the error "Unable to cast value to Object" any reason why?

My LocalScript in StarterPack:

local event = script.Parent:WaitForChild("MakeMessage")

event.OnClientEvent:connect(function(plr,text)
print("EventHappened")
local msg = {
Text = text;
Color = Color3.new(1,1,1); -- custom message color
Font = "SourceSans"; -- custom message font
FontSize = "Size24"; -- custom message size
}
game:GetService("StarterGui"):SetCore("ChatMakeSystemMessage", msg)
end)

My Global Script in SSS:

game.Players.PlayerAdded:connect(function(plr)
plr:WaitForChild("Backpack")
local event = Instance.new("RemoteEvent")
event.Parent = plr.Backpack
event.Name = "MakeMessage"
wait()
event:FireClient("[SERVER] "..plr.Name.." has joined the server!")
end)

Any reasons why, if you could fix it and tell me where I went wrong that is very appreciated thanks!
Report Abuse
McGunz is not online. McGunz
Joined: 26 Dec 2011
Total Posts: 759
01 Nov 2015 02:02 AM
bummpp

srs no one? ive posted a couple forums before and no one has responded to one. anything is very much appreciated
Report Abuse
McGunz is not online. McGunz
Joined: 26 Dec 2011
Total Posts: 759
01 Nov 2015 02:09 AM
ump2b
Report Abuse
McGunz is not online. McGunz
Joined: 26 Dec 2011
Total Posts: 759
01 Nov 2015 02:13 AM
bump3
Report Abuse
Happywalker is not online. Happywalker
Joined: 05 Mar 2010
Total Posts: 3672
01 Nov 2015 02:15 AM
:FireClient(plr, tuple)
Report Abuse
McGunz is not online. McGunz
Joined: 26 Dec 2011
Total Posts: 759
01 Nov 2015 02:17 AM
bump4
Report Abuse
Happywalker is not online. Happywalker
Joined: 05 Mar 2010
Total Posts: 3672
01 Nov 2015 02:17 AM
That goes only to one client btw, for this use you might want to use :FireAllClients(tuple).
Report Abuse
McGunz is not online. McGunz
Joined: 26 Dec 2011
Total Posts: 759
01 Nov 2015 02:23 AM
Okay, thanks Ill see if it works.
Report Abuse
McGunz is not online. McGunz
Joined: 26 Dec 2011
Total Posts: 759
01 Nov 2015 02:28 AM
Oddly, the message still doesn't appear any reason why?
Report Abuse
Happywalker is not online. Happywalker
Joined: 05 Mar 2010
Total Posts: 3672
01 Nov 2015 02:51 AM
Show the two remote lines you changed
Report Abuse
McGunz is not online. McGunz
Joined: 26 Dec 2011
Total Posts: 759
01 Nov 2015 02:56 AM
I changed:

LS:

event.OnClientEvent:connect(function(Player,...)
print("EventHappened")
local message = {
Text = ...;

GS:

event:FireAllClients("[SERVER] "..plr.Name.." has joined the server!")

Sorry lmao, I'm really stupid plus I'm new to Events.
Report Abuse
Happywalker is not online. Happywalker
Joined: 05 Mar 2010
Total Posts: 3672
01 Nov 2015 07:05 AM
Local knows who the player is since it's local, so it doesn't need that argument ._.
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
01 Nov 2015 08:05 AM
A player argument is automatically passed when you fire server.
A player argument does NOT get passed when you fire client.


LS:

local event = script.Parent:WaitForChild("MakeMessage")

event.OnClientEvent:connect(function(text)
print("EventHappened")
local msg = {
Text = text;
Color = Color3.new(1,1,1); -- custom message color
Font = "SourceSans"; -- custom message font
FontSize = "Size24"; -- custom message size
}
game:GetService("StarterGui"):SetCore("ChatMakeSystemMessage", msg)
end)


GS:

game.Players.PlayerAdded:connect(function(plr)
plr:WaitForChild("Backpack")
local event = Instance.new("RemoteEvent")
event.Parent = plr.Backpack
event.Name = "MakeMessage"
wait()
event:FireAllClients("[SERVER] "..plr.Name.." has joined the server!")
end)
Report Abuse
McGunz is not online. McGunz
Joined: 26 Dec 2011
Total Posts: 759
01 Nov 2015 10:16 PM
Ohhh, I see. Thanks all!
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
02 Nov 2015 01:26 PM
Np
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