of     1   

eRanged
#185909517Wednesday, March 23, 2016 7:56 PM GMT

Ok, so I don't want to edit anything. I just want to read items off of their. For some reason when I create a 1 player server in studio, nothing from the StarterGui shows up in the PlayerGui tab. But for some reason stuff from the StarterPack shows up from the backpack. Is there way to access the PlayerGui at all? I tried Remote Events also but it still can't find anything in the PlayerGui. Local: local player = game.Players.LocalPlayer local character = player.Character or player.CharacterAdded:wait() local ItemName = script.Parent.Parent:WaitForChild("Item") local Remote = character:WaitForChild("WeaponDrop") local RemoteA = Remote:WaitForChild("DropEvent") repeat wait() until ItemName.Value ~= "None" -- Waits until It's the value of a real Weapon script.Parent.MouseButton1Click:connect(function() RemoteA:FireServer() print('Fired!') end) Regular (Only Showing Part because it's long and not needed): local RemoteA = script:WaitForChild("DropEvent") RemoteA.OnServerEvent:connect(function(player) print('Received!') -- Loading Assets -- local character = player.Character or player.CharacterAdded:wait() local PlayerGui = player:WaitForChild("PlayerGui") local Torso = character:FindFirstChild("Torso") local StarterGear = player:WaitForChild("StarterGear") local Backpack = player:WaitForChild("Backpack") print('Waiting for Inventory.....') <-- Stops here after printing local MainGui = PlayerGui:WaitForChild("MainInv") print('Inventory Loaded!') local ItemName = MainGui.Options:WaitForChild("Item")
KnownEntity
#185909647Wednesday, March 23, 2016 7:59 PM GMT

local Player = game.Players.LocalPlayer local PlayerGui = Player.PlayerGui:WaitForChild("ScreenGui")
eRanged
#185909800Wednesday, March 23, 2016 8:02 PM GMT

I meant from a server script xD
me2kool2talk2u
#185909895Wednesday, March 23, 2016 8:04 PM GMT

This is one of the cases where the difference between RemoteEvents and RemoteFunctions is vital. RemoteEvents are pieces of code that can be executed from client to server, vice versa. RemoteFunctions act in a similar way, but can return values back to the sender just like a normal function. This would be useful in your case. With FE, the gui in the PlayerGui only exists on the client, and therefore can only be accessed from a LocalScript. Try using a RemoteFunction in a LocalScript that can return the gui to your script. Or use a RemoteEvent to make all the changes to the gui in a LocalScript.
eRanged
#185910046Wednesday, March 23, 2016 8:07 PM GMT

How would I go about doing that? Like returning the gui to the regular script
me2kool2talk2u
#185910377Wednesday, March 23, 2016 8:14 PM GMT

Lookup RemoteFunctions on the wiki and how to use them. You can then create a LocalFunction that returns the gui from a local script. Then you could store it as a variable in your regular script: local gui = game.Workspace.MyRemoteFunction:InvokeClient(player)
eRanged
#185910479Wednesday, March 23, 2016 8:16 PM GMT

I know how to do the :Invoke stuff already and the OnInvoke things but I don't how I would return the gui still. But I am going to look up some tutorial about remotefunctions. thanks for the help
TimeTicks
#185910776Wednesday, March 23, 2016 8:22 PM GMT

Use RemoteEvents instead And also, stop trying to read the playergui from the server. Read the values from the client then just send the info to the server. Like I said before just use 1. Only ONE remote event stored in replicated storage. You don't need to make multiple res. --server script local re = game.ReplicatedStorage:WaitForChild("DropEvent") re.OnServerEvent:connect(function(plr,value) print(value) end) --local script local re = game.ReplicatedStorage:WaitForChild("DropEvent") local player = game.Players.LocalPlayer local char = player.Character or player.CharacterAdded:wait() local PlayerGui = player:WaitForChild("PlayerGui") local Torso = char:FindFirstChild("Torso") local StarterGear = player:WaitForChild("StarterGear") local Backpack = player:WaitForChild("Backpack") local MainGui = PlayerGui:WaitForChild("MainInv") local ItemName = MainGui.Options:WaitForChild("Item") repeat wait() until ItemName.Value ~= "None" script.Parent.MouseButton1Click:connect(function() re:FireServer(ItemName.Value) end)
eRanged
#185910980Wednesday, March 23, 2016 8:27 PM GMT

Thanks, I understand it now ;D
eRanged
#185911169Wednesday, March 23, 2016 8:31 PM GMT

Wait Should I use a RemoteFunction if I want to wait until the Server is done before continuing?
me2kool2talk2u
#185911225Wednesday, March 23, 2016 8:32 PM GMT

Yes. You can write the code so that you wait until you get the return value of the RemoteFunction you called.
eRanged
#185916087Wednesday, March 23, 2016 9:53 PM GMT

Ok I have a easy problem when CallingClient. How Do I get the specific person to call it too. Regular: Remote.OnServerEvent:connect(function(player,value) ClientRemote:FireClient(player) <-- Can I still use the 'player' that called me above?
eRanged
#185918761Wednesday, March 23, 2016 10:32 PM GMT

Nevermind, silly mistake. The LocalScript that's suppose to receive the call was disabled. My bad xD

    of     1