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

Need help with remote functions: Not printing everything is server storage??????"

Asked by
Tizzel40 243 Moderation Voter
6 years ago

why Wont it print everything in server storage when I press G from a local script?

THE LOCAL SCRIPT

01local getstuffrem = game.ReplicatedStorage:WaitForChild("RemoteFunction")
02 
03 
04local play = game.Players.LocalPlayer
05 
06local uis = game:GetService("UserInputService")
07 
08 
09uis.InputBegan:Connect(function(input)---,istyping)
10 
11 
12    if input.KeyCode == Enum.KeyCode.G then
13    print("act")
14    --if not istyping then
15 
View all 24 lines...

AND the SCRIPT

01local getstuffrem = game.ReplicatedStorage:WaitForChild("RemoteFunction")
02 
03 
04 
05 
06 
07 
08getstuffrem.OnServerInvoke:Connect(function(plr)
09 
10for i,v in pairs(game.ServerStorage:GetChildren()) do
11    print(v.Name)
12---------end
13    end
14end)

1 answer

Log in to vote
0
Answered by 6 years ago

OnServerInvoke is not an event. It will expect a callback function to be assigned to it.

1local getstuffrem = game.ReplicatedStorage:WaitForChild("RemoteFunction")
2 
3getstuffrem.OnServerInvoke = function(plr)
4    for i,v in pairs(game.ServerStorage:GetChildren()) do
5        print(v.Name)
6 
7    end
8end

Typically you'd use a remote function when you want to return something back. You weren't returning anything back so just use a remote event.

0
hmm ok thank you Tizzel40 243 — 6y
Ad

Answer this question