Event not firing (unsolved)

I want a system where it constantly checks if the player has 2 requirements to open a gate however for some reason the event is not firing meaning the part does not appear even though i have the requirements
Server Script:

game.Players.PlayerAdded:Connect(function(PlayerJoined)
	while true do
		task.wait(5)
		if PlayerJoined:WaitForChild("leaderstats").MiningGloves.Value == 1 and PlayerJoined:WaitForChild("leaderstats").MiningGear.Value == 1 then
			print("working1")
			game.ReplicatedStorage.RemoteEvent6:FireClient(PlayerJoined)
		else
			warn("not enough")
		end
	end
end)

local script:

game.ReplicatedStorage.RemoteEvent6.OnClientEvent:Connect(function(Event)
	print("working")
	script.Parent.Transparency = 1
	script.Parent.CanCollide = false
end)

It only outputs “working 1” the server script is in serverscriptservice and the local script is in the part i want to make disappear

1 Like

Where is the LocalScript located? Also, checking every 5 seconds won’t be memory friendly. You could try using things like :GetPropertyChangedSignal.

The local script is located inside of the part that im trying to make dissapear

That’s why it isn’t working - this part is likely in the Workspace. If you change this to a Script with a RunContext of client, it should work.

I’d recommend moving the LocalScript to one of the following locations and referencing the part from there, these locations are the locations where a LocalScript will work:

  • StarterPlayerScripts - probably this one
  • StarterCharacterScripts
  • ReplicatedFirst
  • StarterGui
  • StarterPack
2 Likes

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