if hum.WalkSpeed >= module.MaxSpeed then
print("WalkSpeed over "..module.MaxSpeed)
print("Changing...")
wait(0.5)
hum.WalkSpeed = module.StartSpeed
end
hum.WalkSpeed = module.StartSpeed
hum.JumpPower = module.JumpPower
hum.AutoJumpEnabled = module.AutoJump
end
end)
end)
When the players speed is over module.MaxSpeed it dosent change to the StartSpeed.
My main problem is with:
if hum.WalkSpeed >= module.MaxSpeed then
print("WalkSpeed over "..module.MaxSpeed)
print("Changing...")
wait(0.5)
hum.WalkSpeed = module.StartSpeed
end
Your code above looks fine, however I’m wondering how exactly your picking this up? If its off remote event or something, then it won’t work because it fires once, meaning well, your if statement will only fire once. In that case, you could use a loop that would constantly check if the players speed is over the MaxSpeed, that or I’m pretty sure you can use.Changed on the speed and then just go off that.
Thanks for that, I’m just wondering where/when do you call the functions in the module script and how? It could be that your calling it once, so it’s only running your if statement once as I said above.
--[[
- GameServiceable lets you customize your game settings.
- Please, if you enjoy make sure to like. It will help out the model.
- Don't worry if errors pop up, all the errors you may see/encounter may have been just a mistake
-- Developers Note:
[
Make sure that your sprint script is = or less than module.MaxSpeed. If not done, speed will change
to module.StartSpeed.
WARNING!
]
-- Controls:
[
module.StartSpeed: The default speed limit.
module.MaxSpeed: How big can a players' speed get.
module.JumpPower: The power of a players jump.
module.AutoJump: Can a player AutoJump?
Thanks for using GS! Have a good time.
]
]]
local module = {}
-- // void Jump, Walk, etc.
module.StartSpeed = 16 -- How fast the players go (Default: 16)
module.MaxSpeed = 25 -- Change this to how big the speed can go to prevent hackers! (Default: 25)
module.JumpPower = 50 -- The power of a players' jump (Default: 50)
module.AutoJump = true -- Can the player AutoJump (Default: true)
-- // void functions
function module:Kick(p, km) -- p = player, km = kick message
local Players = game:GetService("Players")
if Players:WaitForChild(p) then
Players:FindFirstChild(p):Kick(km)
end
end
-- // void Banned, AutoKickMessage
local AutoKickMessage = "Banned"
module.Banned = { -- People who are banned from your game
"UserId", -- Make sure to put their userId's. Names will NOT work. Maybe in version#0.2
"UserId",
"UserId",
"UserId",
"UserId",
"UserId",
"UserId",
"UserId",
"UserId",
"UserId",
"UserId",
"UserId"
}
-- // void AutoKick, SettingsScript
local players = game.Players
players.PlayerAdded:Connect(function(plr)
for _, id in next, module.Banned do
if tostring(id) then
players:GetPlayerByUserId(id):Kick(AutoKickMessage)
end
end
end)
players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
local hum = char:WaitForChild("Humanoid") or char:FindFirstChildWhichIsA("Humanoid")
local sp = game:GetService("StarterPlayer")
if hum then
print("Settings - True")
hum.Changed:Connect(function()
if hum.WalkSpeed >= module.MaxSpeed then
print("WalkSpeed over "..module.MaxSpeed)
hum.WalkSpeed = module.StartSpeed
end
end)
if hum.WalkSpeed >= module.MaxSpeed then
print("WalkSpeed over "..module.MaxSpeed)
print("Changing...")
wait(0.5)
hum.WalkSpeed = module.StartSpeed
end
hum.WalkSpeed = module.StartSpeed
hum.JumpPower = module.JumpPower
hum.AutoJumpEnabled = module.AutoJump
end
end)
end)
print("Using GS!")
return module
hum:GetPropertyChangedSignal:("WalkSpeed"):Connect(function()
if hum.WalkSpeed >= module.MaxSpeed then
print("WalkSpeed over "..module.MaxSpeed)
hum.WalkSpeed = module.StartSpeed
end
end)