i_Ja
|
  |
| Joined: 06 Apr 2014 |
| Total Posts: 9297 |
|
|
| 17 Dec 2016 08:59 PM |
Huh.?
for _,v in pairs(Choices:GetChildren()) do if v:IsA("BasePart") then v.Touched:connect(function(Part2) local Player2 = game.Players:GetPlayerFromCharacter(Part2.Parent) local Part = v local Val = Part:FindFirstChild("Value") if Part.Name == "End Christmas" and EndChristmas.Value == false and SaveChristmas.Value == false then Val.Value = true Lobby.Value = false EndChristmas.Value = true ChoiceEvent:FireClient(Player2, Player2, "End Christmas") -- < ERROR HERE > elseif Part.Name == "Save Christmas" and SaveChristmas.Value == false and EndChristmas.Value == false then Val.Value = true Lobby.Value = false SaveChristmas.Value = true ChoiceEvent:FireClient(Player2, Player2, "Save Christmas") -- < WILL MOST LIKELY BE ANOTHER ERROR HERE AS WELL > end end) end end
~Add 5k+ Posts~ {Previous Names: ContentCrown, i_Movie, SurfaceLight} |
|
|
| Report Abuse |
|
|
|
| 17 Dec 2016 09:02 PM |
The first argument of FireClient has to be a player object; you have to specify what client you are sending the data to. It looks like you already know this and you're trying to send across Player 2 and it's erroring because Player2 doesn't exist.
Check that Player2 exists and isn't nil; I think that's your problem. |
|
|
| Report Abuse |
|
|
|
| 17 Dec 2016 09:02 PM |
Wouldn't there be an error in the script that would say "Touched is not a valid member of script" cuz "v.Touched:connect(function()" will cause this error
|
|
|
| Report Abuse |
|
|
i_Ja
|
  |
| Joined: 06 Apr 2014 |
| Total Posts: 9297 |
|
|
| 17 Dec 2016 09:04 PM |
It works in studio, but when I went to test it online it didn't work.
Also no, v.Touched:connect(function() would NOT error because if you read the previous 2 lines you would see what I'm doing.
~Add 5k+ Posts~ {Previous Names: ContentCrown, i_Movie, SurfaceLight} |
|
|
| Report Abuse |
|
|
|
| 17 Dec 2016 09:05 PM |
| oh I didnt see that wow im stupid |
|
|
| Report Abuse |
|
|
|
| 17 Dec 2016 09:06 PM |
| also can you post the handler of the event |
|
|
| Report Abuse |
|
|
i_Ja
|
  |
| Joined: 06 Apr 2014 |
| Total Posts: 9297 |
|
|
| 17 Dec 2016 09:06 PM |
This is really starting to trigger me, I've been trying to fix this all day.. :/
~Add 5k+ Posts~ {Previous Names: ContentCrown, i_Movie, SurfaceLight} |
|
|
| Report Abuse |
|
|
i_Ja
|
  |
| Joined: 06 Apr 2014 |
| Total Posts: 9297 |
|
|
| 17 Dec 2016 09:08 PM |
local StageHandler = Instance.new("RemoteEvent", game:GetService("ReplicatedStorage")) StageHandler.Name = "Stage Handler"
and
local StageHandler = game:GetService("ReplicatedStorage"):WaitForChild("Stage Handler")
^ Those have nothing to do with it though
~Add 5k+ Posts~ {Previous Names: ContentCrown, i_Movie, SurfaceLight} |
|
|
| Report Abuse |
|
|
i_Ja
|
  |
| Joined: 06 Apr 2014 |
| Total Posts: 9297 |
|
|
| 17 Dec 2016 09:09 PM |
Oops... This is probably what you meant.. My bad..
SERVER:
for _, v in pairs(Choices:GetChildren()) do if v:IsA("BasePart") then v.Touched:connect(function(Part2) local Player2 = game.Players:GetPlayerFromCharacter(Part2.Parent) local Part = v local Val = Part:FindFirstChild("Value") if Part.Name == "End Christmas" and EndChristmas.Value == false and SaveChristmas.Value == false then Val.Value = true Lobby.Value = false EndChristmas.Value = true ChoiceEvent:FireClient(Player2, Player2, "End Christmas") elseif Part.Name == "Save Christmas" and SaveChristmas.Value == false and EndChristmas.Value == false then Val.Value = true Lobby.Value = false SaveChristmas.Value = true ChoiceEvent:FireClient(Player2, Player2, "Save Christmas") end end) end CLIENT:
ChoiceEvent.OnClientEvent:connect(function(Player, Message) if Message == "End Christmas" then Path.Text = "You're ending christmas" coroutine.wrap(function() for e = 0.5,1,0.1 do EndChristmas.Transparency = e game:GetService("RunService").RenderStepped:wait() end for s = 0.5,0,-0.1 do SaveChristmas.Transparency = s game:GetService("RunService").RenderStepped:wait() end end)() EndChristmas.CanCollide = false SaveChristmas.CanCollide = true else Path.Text = "You're saving christmas" coroutine.wrap(function() for e = 0.5,0,-0.1 do EndChristmas.Transparency = e game:GetService("RunService").RenderStepped:wait() end for s = 0.5,1,0.1 do SaveChristmas.Transparency = s game:GetService("RunService").RenderStepped:wait() end end)() EndChristmas.CanCollide = true SaveChristmas.CanCollide = false end end)
~Add 5k+ Posts~ {Previous Names: ContentCrown, i_Movie, SurfaceLight} |
|
|
| Report Abuse |
|
|
i_Ja
|
  |
| Joined: 06 Apr 2014 |
| Total Posts: 9297 |
|
|
| 17 Dec 2016 09:11 PM |
But as you can really tell, the client has nothing to do with it. The server isn't sending stuff right.. So therefore the server is broken for whatever reason.
~Add 5k+ Posts~ {Previous Names: ContentCrown, i_Movie, SurfaceLight} |
|
|
| Report Abuse |
|
|
|
| 17 Dec 2016 09:13 PM |
well i mean are you ever checking if Player2 is not nil
oh lmao it's i_Movie no wonder |
|
|
| Report Abuse |
|
|
|
| 17 Dec 2016 09:13 PM |
that maybe part of the handler but you need one that one that sets it up
--In local script local RemoteEvent = Instance.new("RemoteEvent", game.ReplicatedStorage)
RemoteEvent.OnClientEvent:connect(function() print("Lol") end
--In server script
local RemoteEvent = game.ReplicatedStorage:WaitForChild("RemoteEvent")
game.Players.ChildAdded:connect(function(player) RemoteEvent:FireClient(player) end) |
|
|
| Report Abuse |
|
|
|
| 17 Dec 2016 09:15 PM |
| I type slow on mobile and every time I type something auto correct changes it. |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
| |
|
i_Ja
|
  |
| Joined: 06 Apr 2014 |
| Total Posts: 9297 |
|
|
| 17 Dec 2016 09:16 PM |
@Real
Sometimes Player2 returns nil, and sometimes it's player1.
What is a good way I can assure it's always sending a player?
~Add 5k+ Posts~ {Previous Names: ContentCrown, i_Movie, SurfaceLight} |
|
|
| Report Abuse |
|
|
i_Ja
|
  |
| Joined: 06 Apr 2014 |
| Total Posts: 9297 |
|
|
| 17 Dec 2016 09:18 PM |
@Time
I'll try that.
~Add 5k+ Posts~ {Previous Names: ContentCrown, i_Movie, SurfaceLight} |
|
|
| Report Abuse |
|
|
|
| 17 Dec 2016 09:23 PM |
local Player2 = game.Players:GetPlayerFromCharacter(Part2.Parent)
You can't automatically assume that the thing that touches the part is a character. You must check if it's a character, I usually do this by doing this.
script.Parent.Touched:connect(function(plr) if plr.Parent:FindFirstChild("Humanoid") then local p = game.Players:GetPlayerFromCharacter(plr.Parent) game.ReplicatedStorage.RemoteEvent:FireClient(p)) end end)
I like cake. |
|
|
| Report Abuse |
|
|
|
| 17 Dec 2016 09:27 PM |
"So therefore the server is broken for whatever reason."
Ah, good logic, assume the ROBLOX servers are broken while ignoring the reason your error is happening which also happens to be the first reply. |
|
|
| Report Abuse |
|
|
i_Ja
|
  |
| Joined: 06 Apr 2014 |
| Total Posts: 9297 |
|
|
| 17 Dec 2016 09:31 PM |
@bun
I wasn't talking about roblox servers you idiot, I was talking about my server script. lol I said that my server script was having problems sending stuff, which therefore means nothing is wrong with the client.
~Add 5k+ Posts~ {Previous Names: ContentCrown, i_Movie, SurfaceLight} |
|
|
| Report Abuse |
|
|
|
| 17 Dec 2016 09:36 PM |
| It's not that the server is having problems sending stuff, it's that you're not supplying a client for it to send stuff to in the first place. |
|
|
| Report Abuse |
|
|