Hello, I have recently started making a new game and have ran into an issue with one of my sections of my Anti Exploit system, It appears that my code is not properly running, Ill leave it below and if someone can help me figure it out and would like to explain to me what I did wrong I would be happy.
LOCAL SCRIPT
-- Start Varibles local player = game:GetService("Players").LocalPlayer -- Check if player has more air than what their AirCapacity is if player.Air.Value > player.Capacity.Value then game.ReplicatedStorage.RemoteEvents.AdminEvents.Kick:FireServer(player, "exploiting air") end
SERVER SCRIPT
-- Admin Events Kick.OnServerEvent:connect(function(player, reason) player:Kick("[Server]: You have been kicked for "..reason) end)
You check the value when the player joins. This means that after you change the value, it will not update and the old value will still be there. To make it update, you will have to use the .Changed event.
-- Start Varibles local player = game:GetService("Players").LocalPlayer player.Air.Changed:Connect(function() if player.Air.Value > player.Capacity.Value then game.ReplicatedStorage.RemoteEvents.AdminEvents.Kick:FireServer(player, "exploiting air") end end)