Warn script error

here’s the output:

16:26:42.643 string - Server - WarnScript:28
16:26:42.643 nil - Server - WarnScript:32
16:26:42.643 Username - Server - WarnScript:33
16:26:42.643 Not a valid name. - Server - WarnScript:41

Here is evidence that it isnt me typing my name wrong

Could you try the edited script again? Now we’re just attempting to debug it as this point here :thinking:

16:35:35.476 Nane is not a valid member of Player “Players.Ziathrius” - Server - WarnScript:19
16:35:35.476 Stack Begin - Studio
16:35:35.476 Script ‘Players.Ziathrius.PlayerGui.ZiaWarn.WarnUI.Warn.WarnScript’, Line 19 - function GetPlayerFromString - Studio - WarnScript:19
16:35:35.476 Script ‘Players.Ziathrius.PlayerGui.ZiaWarn.WarnUI.Warn.WarnScript’, Line 33 - Studio - WarnScript:33
16:35:35.476 Stack End - Studio

Oh my gosh I mistyped the variable

Ok try again LOL

I see. it were to seem, lol, lemme retry it

Can you show us the script again? How it looks like?

If you look at your output, it’s saying that your TextBox’s text is not your name but it is “Username”, could you check it through your explorer and see what it says?

1 Like

Also, I just realized you’re using a normal script and not a local script so changing the Text of your TextBox with your keyboard on the client will not update it on the server, hence why it’s returning “username” since that is the default value you set for the TextBox. I suggest switching to a LocalScript and utilizing Remote Events to tell the server to warn someone and whatnot.

2 Likes

Okay, I got the issue.
So, as I just realised, your script is currently a server script. This will not work, since the local player is changing the text box only on their client, not for everyone. You must use client/server communication for this.
Copy and paste everything from this script, delete it and place it inside a local script (located in the same place as the server script). Then, you have to fire a remote event to the server with the target player. On the server, make the target player’s gui visible.

By the way, this might help.

@Sinnedhayn beat me to it xD

O K A Y
Now that we simplified the issue here, we can now resort to the solution hopefully!

Along with what @Sinnedhayn said, RemoteEvents are pretty much your friend in this situation as they’re capable of handling 1-way transportation (From the client to the server SOOOOOOOOO)

Using the same script, but as a LocalScript:

local Event = game.ReplicatedStorage:WaitForChild("RemoteEvent")

script.Parent.MouseButton1Click:connect(function()
    local target = script.Parent.Parent.WarnUserBox.Text
    local reason = script.Parent.Parent.Reason.Text

    Event:FireServer(target, reason)
end)

AND ON THE SERVER SIDE, inside ServerScriptService:

local Event = game.ReplicatedStorage:WaitForChild("RemoteEvent")

Event.OnServerEvent:Connect(function(ModPlayer, TargetPlayer, Reason)
    print(TargetPlayer)

    for _, Player in pairs(game.Players:GetPlayers()) do
        print(Player.Name)
        if Player.Name:lower() == TargetPlayer:lower() then
            print("Found the target")
            local Gui = Player.PlayerGui.ZiaWarn.ZiaWarnMsg
            Gui.Reason.Text = Reason
            Gui.Visible = true
        end
    end

end)

I think this is how you’d handle it, BUT I’M NOT 100% CERTAIN SO MISTAKES COULD BE MADE HERE

1 Like

Thanks, It works now, Now i can focus on what is next for my admin system.