RemoteEvent Error

Hello, I’m making basic teleport script with fade. When I send all info for fade system, it gives me an error.

Server Side Script:

local FadeEvent = game.ReplicatedStorage:WaitForChild("Remotes").FadeEvent
local TeleportRequest = game.ReplicatedStorage:WaitForChild("Remotes").TeleportRequest

function Teleport(plr, to)
	local to_obj = game.Workspace[to]
	local plr = game.Players[plr.Name].Character
	
	FadeEvent:FireClient("from")
	wait(2)
	FadeEvent:FireClient("to")

	plr:SetPrimaryPartCFrame(to_obj.CFrame)
end

TeleportRequest.OnServerEvent:connect(Teleport)

Client Side Script:

local Remote = game.ReplicatedStorage:WaitForChild("Remotes").FadeEvent

function fade(mode)
if typeof(mode) == "string" then
	if mode == "from" then
		for i = 0,1,0.01 do
			wait()
			script.Parent.BackgroundTransparency = i
		end
	elseif mode == "to" then
		for i = 1,0,-0.01 do
			wait()
			script.Parent.BackgroundTransparency = i
		end	
	end
end
end

Remote.OnClientEvent:connect(fade)

Error:
image

I don’t need any objects just sends strings as you can see.

Edit: If you think that thing which is causing error is basically remote event fired in function that is connected to other remote that is wrong. Tried in clean script too but same results

The first argument on :FireClient needs to be the player.

local plr = game.Players[plr.Name] --not the char, make seperate var for char to teleport.

FadeEvent:FireClient(plr, "from")
wait(2)
FadeEvent:FireClient(plr, "to")
1 Like