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

My remote function is not working but is not giving an error in the output can you help?

I was working on a system and I need a RemoteFunction to get a datastore to return to a GUI. Though while using it I found out it was not even Invoking the Server. The codes I have are below.

Server:

--------------
-- Services --
--------------
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Datstore = game:GetService("DataStoreService")

local Warrant = Datstore:GetDataStore("PlayerWarrant")

function GetRes.OnServerInvoke(from, suspect)
	local suspectID = game:GetService("Players"):GetUserIdFromNameAsync(suspect)
	local INFO = Warrant:GetAsync(suspectID) or {User = suspectID, Status = false, Reason = ""}
return INFO
end

Client:

--------------
-- Services --
--------------
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")

-- Check Warrant Button --
CheckButton.MouseButton1Down:Connect(function()
	local result = GetRes:InvokeServer(tostring(CheckUser.Text))
	local playername = Players:GetNameFromUserIdAsync(result.User)
	User.Text = playername
end)

Please help me.

Visual: https://gyazo.com/d4d369983ecc596c7bb3c3c048b356b3

2 comments

0

You'll need to return in your callback function.

0

I did that in my script. But I forgot to put it on here one second

1 answer

--------------
-- Services --
--------------
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Datstore = game:GetService("DataStoreService")

local Warrant = Datstore:GetDataStore("PlayerWarrant")

GetRes.OnServerInvoke = function(form,suspect)
    local suspectID = game:GetService("Players"):GetUserIdFromNameAsync(suspect)
    local INFO = Warrant:GetAsync(suspectID) or {User = suspectID, Status = false, Reason = ""}
    return INFO
end

1 comment

0

Didn't do anything. I also dont see any difference besides you changing from in my script to form

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