我在做一个游戏,在不同路段不同walkspeeds,但我不希望人们改变自己的walkspeed与黑客。我的解决办法是让一个组成部分,它延伸,以适应整个区域,使其不可见+ CanCollide禁用,然后用孩子的脚本来杀死你,如果你的walkspeed是不是应该是什么:
script.Parent.Touched:connect(function(WSChecker)
if not WSChecker.Parent then return end
local humanoid = WSChecker.Parent:FindFirstChild("Humanoid")
if not humanoid then return end
if (humanoid.WalkSpeed ~= 25) then
humanoid.Health = 0
end
end)
问题是,它不与部分多个玩家在同一时间工作,我想打它,所以它会踢球员,而不是杀死它们。有没有办法去了解这些问题呢?它以仅在部分检查他们的WS,我不知道如何使它踢谁改变了他们的WS,而不是杀死它们。
我建议钩住你的功能,每个玩家的人形,而是和使用Humanoid.Running event。
Humanoid.Running为您提供他们目前正在运行的速度,这意味着你可以检查,速度是以往任何时候都高于某个阈值,并惩罚他们,如果它是。
代码示例:
player.Character.Humanoid.Running:Connect(function(Speed)
print(Player, "is running at speed", Speed)
end)
至于踢,你想用球员:踢()。
if (humanoid.WalkSpeed ~= 25) then
game.localplayer.remove:fire
end
结束)
也许这是好还是坏?我是一个新手编剧,希望你看这个!
if (humanoid.WalkSpeed ~= 25) then
game.Players.LocalPlayer:Kick()
end
这应该够了吧...