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

Sending a variable to a client using arguments?

I've tried to send a variable using arguments. From Server to Client then it should print variable. The problem is when the script is running,then it's just printing " nil ". But how can I fix this?

My serverside script

local Event = game.ReplicatedStorage.Printy
while true do
	wait(0.0555)
	local X = "hello"
	Event:FireAllClients(X)
end

Clientside:

local Event = game.ReplicatedStorage.Printy

Event.OnClientEvent:Connect(function(player,X)
print(X)
end)

It's always ending up printing " nil ".

1 comment

0

Np :D Can you upvote and accept as answer pls?

1 answer

✓ Accepted answer

On ServerEvent, you receive a player who fired the RemoteEvent, but on ClientEvent, you do not receive a player. Delete the player parameter for your function, because that's what X is :D

4 comments

0

Thank you for this reponse. :D

0

Np :D Can you upvote and accept as answer pls?

0

He can't upvote yet

0

Don't remind users to accept your answer. It is nature for them to accept it. You're just being greedy.

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