Remote event still doesnt fire when player joins the game and value is set to true

Yooo wsg dev forum peeps, still seem to be having this little issue (its basically the exact same thing that was troubling me yeserday) and i still havent found a fix yet so help would be appreciated

So the quick gist is that im trying to make serverscript fire a remote event but only if the player has a value that is set to true.

My current script looks like:

local Players = game:GetService("Players")


Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Wait() 
	if player:WaitForChild('Booleans').Actions.bruh.Value == true then
		game.ReplicatedStorage.theamong:FireClient(player)
		print("WOOOO")
	end
end)

and the local script that the remote event is trying to fire looks like this.

local RemoteEvent = game.ReplicatedStorage.theamong

RemoteEvent.OnClientEvent:Connect(function()

	wait(2)
	game.Workspace.Infantry:Destroy()

end)

It seems like the remote event isnt firing at all when the player joins even if the value is to true and ive got no clue why. have i put something wrong here?

Thanks in advanced.

Hey! Can you please clarify what Booleans is? Is that something you’re manually putting there? Looking at this, I’m sure there’s better ways to handle what you’re trying to achieve if you can explain What you’re trying to do exactly, we can guide you better

Oh fo sho! Booleans is a folder thats inserted into the player when they join, inside that folder is another folder called actions and then inside that folder is where we finally get to the value which is bruh. What im trying to do is fire a remote event on join only if bruh is set to true.

Its like this basically.
image

Why not attach a function to .Changed of the BoolValues? I’m pretty sure that’ll do the trick
for example

player:WaitForChild('Booleans').Actions.bruh.Changed:Connect(function(value)
     if value == true then game.ReplicatedStorage.theamong:FireClient(player) end
end)
2 Likes

Ah i see, worked like a charm, thanks dude. didnt know it was that simple.

1 Like

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