Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why is OnClientEvent bringing out an error? [CLOSED]

I couldn't figure out why this error occurs: 16:47:19.225 - OnCilentEvent is not a valid member of RemoteEvent

This function is listed on the Roblox Wiki and it doesn't work for me. I'm new to RemoteEvents. Am I doing a easy mistake?

-- Server Script
game.Players.PlayerAdded:connect(function(player)
	local event = Instance.new('RemoteEvent',player)
	local playerName = player.Name
	-- more stuff
	event.Name = 'Dead'
	event:FireCilent(playerName,1,"asmiundyuay",99999999999)
end)
-- Cilent Script
local event = game.Players.LocalPlayer:WaitForChild('Dead')
event.OnCilentEvent:connect(function(typeOfPower,Profile,XP)
	print(Profile,XP)
end)

1 comment

0

You spelled Client wrong? Not sure if that was on purpose.

1 answer

✓ Accepted answer

You misspelled client, as you typed cilent. Also, you are attempting to fire this to a string, when it should be a Player instance.

Should work:

-- Server Script
game.Players.PlayerAdded:connect(function(player)
    local event = Instance.new('RemoteEvent',player)
    local playerName = player.Name
    -- more stuff
    event.Name = 'Dead'
    event:FireClient(player,1,"asmiundyuay",99999999999) --Here you tried to fire it to a string, should be an instance player. You also misspelled Client here.
end)
-- Cilent Script
local event = game.Players.LocalPlayer:WaitForChild('Dead')
event.OnClientEvent:connect(function(typeOfPower,Profile,XP) --here you spelled client incorrectly
    print(Profile,XP)
end)

1 comment

0

Surprised I didn't see that, thanks!

This discussion is preserved as it was. New answers, comments, and votes are closed.