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

The Script i made its not working for some reason someone please help me?

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!

1 answer

✓ Accepted answer

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

1 comment

0

Thanks!

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