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

How to change a character's humanoid using variables?

Asked by 4 years ago

The script will choose the player and put the player's name on a variable "chosenplayer" , in need to use the variable to change the player's humanoid on the function "ChooseEvent()", how do i do that?

current script:

players = {}
local chosenplayer = nil
local chosenplayer2 = nil
local workspace1 = game.Workspace
local serverstore = game:GetService("ServerStorage")
events = {"man"}
local chosenevent = nil

local function onCharacterAdded(chr)
    table.insert(players, chr)
end

local index = -1

local function onCharacterRemoved(removed)
    for i, v in pairs (players) do
        if removed == v then
            index = i
        end
    end
    table.remove(players, index)
end

local function ChooseEvent()
    local chooseevent = events[math.random(1,#events)]
    chosenevent = chooseevent
    print(chosenevent)
    if  chosenevent == "man" then
        local value = players[math.random(1,#players)]
----- script that changes the player's stats'
    end
end






game.Players.PlayerAdded:Connect(onCharacterAdded)
game.Players.PlayerRemoving:Connect(onCharacterRemoved)


0
Your script just work fine for me. I don't know what's wrong. Xapelize 2658 — 4y
0
i can't think of a script that will choose the player from workspace according to whats in "chosenplayer" variable, something like: game.workspace.chosenplayer.Humanoid.Walkspeed = 26 PicoTheRiko 34 — 4y

Answer this question