Check if MoveTo() is nil

Is it possible to check if MoveTo() is nil? Basically im trying to disable the ability to perform actions in my local script if MoveTo() is nil. Thanks!

I don’t understand your question. Can you further elaborate it?

Yes sorry. Basically, I’ll call MoveTo() on the server and I want to be able to check if MoveTo is true or false kind of in a sense so that on the client Im able to do my checks in UserInputService to see if they are able to perform an action. Sorry if this was worded horribly. If you still don’t understand I’ll try and explain it better if I can.

If I’m understanding correctly, you are calling a function on the server, and want to send the results of the function to the client, and do your checks on the client.

To send data from the server to the client, you need to use something called a RemoteEvent. Here is an example:

Server:

local Event = Instance.new("RemoteEvent")Event.Name="MoveToEvent"
Event.Parent=game.ReplicatedStorage
Event:FireClient(player, MoveTo())

Client:

local Event = game.ReplicatedStorage:WaitForChild("MoveToEvent")
Event.OnClientEvent:Connect(function(results)
    if results==nil then

    end
end)

If you are confused on how to properly use RemoteEvents, consider the hyperlink which explains all the API with RemoteEvents.

This could work, thanks! (30000)

1 Like