Will server error to all players if I dont check if something exists

Say I have a trail shop. I use a remote event whenever a player wants to buy a trail. The trails argument is the trails Name, a string Value.

-- Just made this up
local buy = script.Parent
buy.MouseButton1Click:Connect(function()
     local trail = script.Parent.Parent
     local str = str.Name
     buyTrail:FireServer(str)
end)

Now say a nasty exploiter came along and changed this string value into an Int-Value, or a BoolValue, or nothing at all! Of course the server will error on that player, but will it effect all players in the game as well? If that is the case, then would I just do the following below:

buyTrail.OnServerEvent:Connect(function(player, trailName)
      if trailName:IsA("StringValue") and trailName ~= nil then
          --Stuff
     end
end)

Have a good day!

In order for the reference to exist on the server, it has to exist on the client and the server, otherwise its reference on the server will be nil.

No, in this scenario if an exploiter causes the server to error, no clients will be affected by it and everything should continue to run fine. However, if you do want to prevent the error on the server you should ensure the trail instance you’re looking for exists with FindFirstChild() before doing anything with it.

1 Like