Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to convert this localscript to a serverscript for a little extra exploiter protection?

Asked by
Donut792 216 Moderation Voter
5 years ago

so when i change this script over to a regular script in ServerScriptService the game will not load and the only thing that prints are inf yields on core roblox scripts it does this whenever i have a while true do loop on a serverscript all except a day/night cycle i made it seems to run fine

here is the script i am trying to convert and yes i have the player get kicked on a localscript i planned on changing that

wait(3)
while true do
local plr = game.Players.LocalPlayer
local MaxHealth = plr:WaitForChild("MaxHealth")
local First = MaxHealth:WaitForChild("First")
local Second = MaxHealth:WaitForChild("Second")
local Third = MaxHealth:WaitForChild("Third")
local Fourth = MaxHealth:WaitForChild("Fourth")
local Fifth = MaxHealth:WaitForChild("Fifth")
local hum = plr.Character:WaitForChild("Humanoid")
if First.Value == true then
    Second.Value = false
    Third.Value = false
    Fourth.Value = false
    Fifth.Value = false
     if hum.MaxHealth ~= 110 then
        hum.MaxHealth = 110
    end
end  
if Second.Value == true then
    First.Value = false
    Third.Value = false
    Fourth.Value = false
    Fifth.Value = false
     if hum.MaxHealth ~= 120 then
        hum.MaxHealth = 120
    end
end  
if Third.Value == true then
    First.Value = false
    Second.Value = false
    Fourth.Value = false
    Fifth.Value = false
 if hum.MaxHealth ~= 130 then
        hum.MaxHealth = 130
    end
end  
if Fourth.Value == true then
    First.Value = false
    Second.Value = false
    Third.Value = false
    Fifth.Value = false
 if hum.MaxHealth ~= 140 then
        hum.MaxHealth = 140
    end
end 
if Fifth.Value == true then
    First.Value = false
    Second.Value = false
    Fourth.Value = false
    Third.Value = false
 if hum.MaxHealth ~= 150 then
        hum.MaxHealth = 150
    end
end  
    if hum.MaxHealth >= 151 then
        game.ReplicatedStorage.HumanoidKick:FireServer()
    end
    if hum.WalkSpeed >= 37 then
        game.ReplicatedStorage.HumanoidKick:FireServer()
    end
    if plr.Character.Humanoid.JumpPower >= 51 then
        game.ReplicatedStorage.HumanoidKick:FireServer()
    end
    if plr.Character.Humanoid.HipHeight >= 1.36 then
        game.ReplicatedStorage.HumanoidKick:FireServer()        
    end
    if plr.Character.Humanoid.MaxSlopeAngle >= 90 then
        game.ReplicatedStorage.HumanoidKick:FireServer()
    end
wait(.4)
end
0
Well for one LocalPlayer doesn't exist on the server, but you should check output for errors to know what's wrong. If there are none then the script is not running. Also you shouldn't redefine the values that don't change inside the while loop. gullet 471 — 5y
0
ik about localplayer i use game.Players.PlayerAdded:Connect(function(plr) when its a server script and what should i do then because i want it check if they have a value set then it changes to what i set for them and an exploiter can change their humanoid values thats what i made this script for to regulate that but also have it a server script so i dont have to use events that they can fire Donut792 216 — 5y
0
an exploiter can also just delete this script, I don't get the point much...realistically if you want to protect your game it needs to be almost entirely server side checks for protection Vulkarin 581 — 5y
0
Vulkarin thats the point of why i want it to be a server script make sure to read the question and not just the script Donut792 216 — 5y

Answer this question