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

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

Asked by 5 years ago

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

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

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
0
Thanks! ImAnonymousBan 24 — 5y
Ad

Answer this question