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

RemoteFunction Not Firing?

I have experience when working with filtering enabled, in this case I've just created a new place and am relying on a RemoteFunction. However, nothing seems to be happening, no errors, no prints to the output, nothing. I have included my relevant place hierarchy.

Could this be a bug, am I doing something wrong?

Workspace > ReplicatedStorage > RemoteEvents > Dupe [RemoteFunction] > Script

Players > Player > PlayerGui > ScreenGui > LocalScript

and my code:

-- Server script

local sp = script.Parent

function sp.OnServerInvoke(player, argument)
	print("Remote function invoked")
	print(argument[1].Name)
	print(argument[2].Name)
	local new = argument[1]:Clone()
	new.Parent = argument[2]
	return new
end

-- Localscript (context only)

if key == "x" then
	if plane.Engine:findFirstChild("FlyScript") then
		game.ReplicatedStorage.RemoteEvents.DestroyInstance:FireServer(plane.Engine)
		plane.Engine.BodyVelocity.maxForce = Vector3.new(0,0,0)
		plane.Engine.BodyGyro.maxTorque = Vector3.new(0,0,0)
		game.ReplicatedStorage.RemoteEvents.EditProperty:FireServer(plane.Engine.On, "Value", false)
	else
		print("doesn't exist should clone")
		FS = game.ReplicatedStorage.RemoteEvents.Dupe:InvokeServer({script.FlyScript, plane.Engine})
		game.ReplicatedStorage.RemoteEvents.EditProperty:FireServer(FS, "Disabled", false)
		plane.Engine.BodyVelocity.maxForce = Vector3.new(2000000000,2000000000,2000000000)
		plane.Engine.BodyGyro.maxTorque = Vector3.new(0,9000,0)
		game.ReplicatedStorage.RemoteEvents.EditProperty:FireServer(plane.Engine.On, "Value", true)
	end
end

I appreciate your time and efforts.

1 answer

✓ Accepted answer

Hmm. The only 'bug' there could be is with your OnServerInvoke event. I'm not quite familiar with the way you did it, so I'll offer mine:

sp.OnServerInvoke:connect(function(player, argument)
	print("Remote function invoked")
	print(argument[1].Name)
	print(argument[2].Name)
	local new = argument[1]:Clone()
	new.Parent = argument[2]
	return new
end)

Your issue was most likely due to no proper connection line.

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