Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Would these scripts work?

Hello again. I can't test my scripts currently because I am on a mobile device right now. I was just wondering if these scripts would work. Thanks. :)

-- Reason for the script, everytime someone clicks the screen (textButton) then the number (textbox) will go up by 1 (or 3 if you have the gamepass)-- it also will detect if someone is hacking by detecting if someone's per click is not 1 OR 3, it also makes the number go up by 10 if the player joins the game -- if someone can make a save function when the player leaves and enters the game that saves the number then that would be great. Thanks. :)

local pass = 182358984
local number = 0
local upgrade = 1

function Auth(player)
     return game:GetService("GamePassService"):PlayerHasPass(player, pass)
end

game.Players.PlayerAdded:connect(function(player)
     local number = number + 10
end)

script.Parent.MouseButton1Click:connect(function()
     if Auth then
          local upgrade = 3
     end
     number = number + upgrade
     script.Parent.Parent.Number.Text = number
end)

if upgrade ~= 1 or 3 then
     game.Players.LocalPlayer.Character:Destroy()
end

-- Reason for this script: seeing is someone is speed hacking by checking if there speed is not 16

local player = game.Players.LocalPlayer.Character

if player.Humanoid.WalkSpeed ~= 16 then
     player:Destroy()
end

1 answer

It appears you misunderstand if statements a bit.

If statements only run a single time. When they run, the condition will either be true or false. If it's true, the code will continue normally. If it's false, the computer will skip down to the end of the if statement.

If the condition isn't true at the exact millisecond the if statement runs, then the if statement will be skipped over and never read again. It does not matter if the condition is true later; it won't be checked again.

Instead of an if statement, use an event. An event will run whenever something happens. You can find the specific names on the wiki.

I'm not so sure about your methods for hacker prevention, but I don't know how cheat engines work so you could be correct.

5 comments

0

My friend said he might get cheat engine for me so he could help. Thanks. I have so would I do a "while loop" around all the if statements?

0

I have another question to. Can you make a script that saves the number everytime the player leaves or enters the game?

0

You COULD put the if statements that you wanted to repeat in a while loop, but it would be MUCH BETTER to use an event. In this case, the Changed event should suffice. As for saving, that's very possible. Look up Data Store on the wiki.

0

I did look up data store on the wiki. It did not explain it very well. Or it all might just be to advanced for me. Either way a script to save the number would be great.

0

This is not a request site, no one here will make scripts for you.

This discussion is preserved as it was. New answers, comments, and votes are closed.