Hello! I’m having a weird error that for days I’ve been trying to fix. Below is the code that activates when a RemoteFunction in ReplicatedStorage is fired. The issue is, it doesn’t always return/receive. What I mean by this is *1 always prints, *2 print rarely like per server, so in studio it can work but it also cannot, like a 1/5 chance.
The returns return empty strings (nil) for the times it doesn’t work, and it literally makes no sense as to why it wouldn’t work. If anyone could help me that’d be amazing.
ServerScriptService
RemoteFunction Handler Script
print("hello") -- *1
game.ReplicatedStorage.Functions.Function.OnServerInvoke = function(Player,Type,Data)
print(Player) -- *2
print(Type) -- *2
print"hellO" -- *2
if Type == "HasPass" then
return game.MarketplaceService:UserOwnsGamePassAsync(Player.UserId,7213132)
elseif Type == "GroupRank" then
return Player:GetRankInGroup(4313692)
elseif Type == "IsInGroup" then
return Player:IsInGroup(4313692)
elseif Type == "UserHasSpecificPass" then
return game.MarketplaceService:UserOwnsGamePassAsync(Player.UserId,Data["GamepassId"])
end
end
RemoteFunction Location
Example Call
View Example
if game.ReplicatedStorage.Functions.Function:InvokeServer("HasPass",nil) == true then
if workspace.PremiumExclusionZone then
workspace.PremiumExclusionZone:Destroy()
game.Players.LocalPlayer.PlayerGui:FindFirstChild("Premium").Adornee = nil
end
end
There are no errors except for the error saying a number can’t be calculated with a number and a nil value.
I’m sorry if I’m breaking any rules. This is my second time as an OP.