#Metatable function doesn't work

11 messages · Page 1 of 1 (latest)

inner wharf
#

speed doesn't change

#

brain hurt

plain tendon
#

What are you even trying to do?

mortal orbit
#

What is the problem ?

plain tendon
#

I might be dumb as fuck, but this is a way to do it

local plr = game.Players.LocalPlayer
local hum = game.Workspace:WaitForChild(plr.Name):FindFirstChild("Humanoid")

local UIS = game:GetService("UserInputService")
UIS.InputBegan:Connect(function(input, GPE)
    if input.KeyCode == Enum.KeyCode.Q and GPE == false then
        hum.WalkSpeed = 69 --bitch
    end
end)
inner wharf
#

i need it

#

like that

mortal orbit
#

Your speed doesn't change ?

#
local Player = {}
Player.__index = Player

function Player:AdjustSpeed(n)
    self.Player.Character.Humanoid.WalkSpeed = n
        print("zaza")
end

function Player.new(player)
    local NewPlayer = setmetatable({}, Player)
    NewPlayer.Player = player
    return NewPlayer
end

local UIS = game:GetService("UserInputService")
UIS.InputBegan:Connect(function(input, GPE)
    if input.KeyCode == Enum.KeyCode.Q then
        for _, player in ipairs(game.Players:GetPlayers()) do
            local newPlayer = Player.new(player)
            newPlayer:AdjustSpeed(69)
            print("Changed to 69 walkspeed bitch")
        end
    end
end)