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

Help with remotes and stuff, and passing stuff from client to server?

Okay, so I wanna start by checking if the class that was sent was 1 (economy). If it is, I give the player the economy card, so I tried to rename the backpack to hi just to test (of course I can't do that, I'm not dumb.) but the error I got even before when I was trying to rename the backpack was as follows:

Player is not a valid member of Players

Serverside code:

local revent = game:GetService('ReplicatedStorage').class
local function test (Player,classes)
if classes == 1 then
game.Players.Player.Backpack.Name = 'hi'
end
end
revent.OnServerEvent:Connect(test)

Clientside code:

local revent = game.ReplicatedStorage:WaitForChild('class')
local classes = 1
local Player = game.Players.LocalPlayer
local frame = script.Parent.Parent.Parent
local frame2 = script.Parent.Parent.Parent.Parent.endpoint_pass



script.Parent.MouseButton1Click:Connect(function()
frame:TweenPosition(UDim2.new(1, 0,0, 0), 'Out', 'Quint', '1')
frame2:TweenPosition(UDim2.new(0, 0,0, 0), 'Out', 'Quint', '1')
script.Parent.Parent.Parent.Parent.exit.Visible = false
revent:FireServer(classes)
end)

also, I know I didn't put players in the serverside code, if I did, the script encountered this error:

https://scriptinghelpers.org/questions/101477/remote-keeps-printing-my-username-even-though-i-stated-player-and-other-value

6 comments

0

what line is the error one?

0

*on

0

Line 4 in serverside code

0

The issue is Player is not a valid member of Players, even though it should be because it's always passed over by default, right?

0

Wrong its only referenced by remotes events and I think gamepasses etc make sure you referenced player.

0

First try making a loop after if classes = 1 then to find the backpack then change the name of it also,you dont do

1 answer

The reason why your code wasn't working is that you didn't reference the player who joined so all you have to do is add a player Added event. Also the player argument is only automatically referenced by Roblox using a remote event

On line 2 add the following code

local Player = game:GetService("Players")

1 comment

0

I'm sorry, I was a bit confused with this. This is for a self check-in, so the GUI is going to be placed on the player's screen if they click a brick.

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