Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Error valid member of player?

Asked by 5 years ago
Edited 5 years ago

I am scripting a room giver I have done all the coding that I can possibly do but it says Enter username is not a valid member of Players when I enter their name in the room giver. Heres what I have if you have anything that can help please let me know.

script.Parent.confirm.MouseButton1Click:connect(function()
    if script.Parent.errormsg.Text == "Error: Room not available" then
        warn("Room not available") else
        if game.Players[script.Parent.username.Text] then
        game.ServerStorage.ReceptionSystem.RoomsFolder["Room"..script.Parent.roomnum.Text].Value = true
        local newVal = Instance.new("StringValue", game.ServerStorage.ReceptionSystem.CheckedIn)
        newVal.Name = "Room"..script.Parent.roomnum.Text
        newVal.Value = game.Players[script.Parent.username.Text].Name
        local newKey = game.ServerStorage.ReceptionSystem.Card:Clone()
        newKey.Parent = game.Players[script.Parent.username.Text].Backpack
        newKey.Name = "Room "..script.Parent.roomnum.Text
        newKey.CardNumber.Value = script.Parent.roomnum.Text
        script.Parent.confirm.Text = "Checked in!"
        script.Parent.roomnum.Text = "Enter room number"
        script.Parent.username.Text = "Enter username"
        wait(0.5)
        script.Parent.confirm.Text = "Check-in"
        end
    end 
end)

script.Parent.roomnum.Changed:connect(function()
    script.Parent.errormsg.Text = " "
    if game.ServerStorage.ReceptionSystem.CheckedIn["Room"..script.Parent.roomnum.Text] then
        script.Parent.errormsg.Text = "Error: Room not available"
    end
end)

I always get error around line 4

Here is the link for the Screenshot explorer http://www.shorturl.at/eJNV1

0
Please put this in a code block. This is very hard to read. namespace25 594 — 5y
0
Also, do you mind maybe showing the explorer? Syntheix 7 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

From my perspective, it seems you are trying to make a textbook that, when you enter a player's username, it gives them a room. If you are getting the username from the textbook, I recommend getting the TextBox.Text, checking if the text in the textbook is a player, then continue your script.

I didn't write code because of not being able to see the explorer, so I don't know what to look for.

Hopefully this helps, as I am fairly new too scripting.

Ad

Answer this question