Every value from a local script to a server script returns as nil

I’m trying to return the BoolValue to the server script, but they return as nil no matter what
Firing the client even from the script:

	mainsword.Handle.Touched:Connect(function(hit)
		if hit and hit:FindFirstAncestorOfClass("Model") then
			local brg = game.ReplicatedStorage.Get_brg_value:FireClient(player)
			print(brg)
		end
	end)

Local script OnClientEvent:

game.ReplicatedStorage.Get_brg_value.OnClientEvent:Connect(function()
	return barraging.Value
end)

Also I’d like to add that this isn’t because the value of Barraging is nil or the BoolValue itself doesn’t exist. Even when I just return “true” or “false” it returns as nil.

Use a RemoteFunction for this, you cannot return anything with RemoteEvents. For example (with Get_brg_value as a RemoteFunction):

	mainsword.Handle.Touched:Connect(function(hit)
		if hit and hit:FindFirstAncestorOfClass("Model") then
			local brg = game.ReplicatedStorage.Get_brg_value:InvokeClient(player)
			print(brg)
		end
	end)
game.ReplicatedStorage.Get_brg_value.OnClientInvoke = function()
	return barraging.Value
end

aye thanks man, works perfectly now

As mentioned earlier, be careful when doing this.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.