Remote event doesn't seem to fire

I’m trying to just make the part invisible for the client when they step on the part.
(Simplified of version for a more complex mechanic in a game)
I don’t know why but the client event doesn’t seem to fire.
“hit”, and the player name prints, but “Invisible” doesn’t, nor does the part go invisible.

Server Script:
image

Local Script:
Annotation 2020-07-12 162822

2 Likes

where is your local script is located at?

In the part.
Should it maybe be in ServerScriptStorage, ServerStorage, or StarterPlayerScripts

well your problem is that it’s in the workspace move it to player scripts or something which is associated with the player

1 Like

Also

local function Red(Player)
--Not
local function Red()

this doesn’t matter because he is not using anything to put that player argument in

I see that, and yes it works fine, its just good practice incase you need the player argument later. you dont have to use .OnPlayerAdded

OnClientEvent doesn’t even return the player i’m pretty sure. The client will just be the client who received the event

1 Like

also there is a better way to define the player here all you need to do is this:

local player = game.Players:GetPlayerFromCharacter(hit.Parent)

well it will just try it once :slight_smile:

Yeah. That was just because I quickly whipped up a much more simplified version of the experiment for the post. The actual use is turning on a spinning arrow, to designate a drop-off point, but has a lot of other parts around it that i already knew weren’t the problem.

--<Server:
game:GetService("ReplicatedStorage").RemoteEvent:FireClient(game.Players.MightTea);

--<Client:
game:GetService("ReplicatedStorage").RemoteEvent.OnClientEvent:Connect(function(Arg)
	print(Arg);
end)

--[[This will output nil, since the only argument that was passed was the player object, which 
is required when using firing clients]]

--//
--<Server
game:GetService("ReplicatedStorage").RemoteEvent:FireClient(game.Players.MightTea, "Hello World");

--<Client
game:GetService("ReplicatedStorage").RemoteEvent.OnClientEvent:Connect(function(Arg)
	print(Arg);
end)

--[[
This will then output "Hello World" since it's the first 'actual' argument
So I don't quite understand what you mean? Could You Explain?
]]