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
|
  |
| 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
|
  |
| Joined: 26 Dec 2011 |
| Total Posts: 759 |
|
| |
|
McGunz
|
  |
| Joined: 26 Dec 2011 |
| Total Posts: 759 |
|
| |
|
| |
|
McGunz
|
  |
| Joined: 26 Dec 2011 |
| Total Posts: 759 |
|
| |
|
|
| 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
|
  |
| Joined: 26 Dec 2011 |
| Total Posts: 759 |
|
|
| 01 Nov 2015 02:23 AM |
| Okay, thanks Ill see if it works. |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 01 Nov 2015 02:51 AM |
| Show the two remote lines you changed |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 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 |
|
|
|
| 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
|
  |
| Joined: 26 Dec 2011 |
| Total Posts: 759 |
|
| |
|
| |
|