local ReplicatedStorage = game:GetService("ReplicatedStorage") local createPartEvent = Instance.new("RemoteEvent", ReplicatedStorage)
local function onCreatePartFired(player) local realnow = game.Players(player.Name).PlayerGui.Report.Main.MainText.Text print(realnow) end
createPartEvent.OnServerEvent:Connect(onCreatePartFired)
if i clicked the button the button is already coded if i clicked it. it fire the server and it sasys ImAnonymousBan is Not A Valid Player
Please Help!
Server Script
local ReplicatedStorage = game:GetService("ReplicatedStorage") local createPartEvent = Instance.new("RemoteEvent", ReplicatedStorage) local function onCreatePartFired(player,realnow)--The player isn't the player's name it is the player object. print(realnow) end createPartEvent.OnServerEvent:Connect(onCreatePartFired)
The server can't access the PlayerGui, so we want to send the MainText.Text with the :FireServer()
Wherever You Do :FireServer() On The createPartEvent
local player = game.Players.LocalPlayer--If you already have player defined in the LocalScript don't do this. :FireServer(player.PlayerGui.Report.Main.MainText.Text)--Replace :FireServer() with this