FireClient doesn't do anything

  1. What do you want to achieve?
    A GUI that shows the player their role.

  2. What is the issue?
    I am using FireClient to show the player their role but it doesn’t do anything and no errors show up in the output.

  3. What solutions have you tried so far?
    I looked up why this could be happening but I haven’t found a solution.

Server:

local function pickKiller()
	local players = game.Players:GetChildren()
	local killer = players[math.random(#players)]
	RS.PresentRole:FireClient(killer, "Jeff")
end

Local:

game.ReplicatedStorage.PresentRole.OnClientEvent:Connect(function(role)
	script.Parent.YouAre.Visible = true
	script.Parent.Description.Visible = true
	script.Parent.Role.Visible = true
	if role == "Survivor" then
		script.Parent.Role.Text = "Survivor"
		script.Parent.Role.TextColor3 = Color3.fromRGB(0, 255, 0)
		script.Parent.Description.Text = "Find all 8 teddy bears to prove Jeff's existence"
	end
	if role == "Jeff" then
		script.Parent.Role.Text = "JEFF"
		script.Parent.Role.TextColor3 = Color3.fromRGB(255, 0, 0)
		script.Parent.Description.Text = "Kill everyone as fast as you can"
	end
end)

isn’t this supposed to contain the minimum number at first start???

local killer = players[math.random(1, #players)]
1 Like

That didn’t seem to change anything, everything else works fine when selecting the killer like spawning it in but firing that event doesn’t do anything

It may be because of where the LocalScript is located.
If its not already, try putting in in StarterPlayerScripts.

Other issues may be
something wrong with selecting the player, maybe try

local function pickKiller()
	local players = game.Players:GetPlayers()
	local killer = players[math.random(1,#players)]
	RS.PresentRole:FireClient(killer, "Jeff")
end

See if the event is firing in the event area as well, put a print right below the function to make sure its firing properly.

I’ve had similar issues, and most of the time it ends up being something relating to firing the player, or the wrong LocalScript parent.

after trying what i suggested above, come back with the results, i will attempt to help further if there’s still issues.

2 Likes

Make sure the client is loaded before selecting a Jeff. See if anything changes if you wait 5 seconds.

1 Like

This worked, thanks for your help

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.