it seems like the 30 line has an math random error, but i don't see anything wrong with it . i don't know what the output is trying to tell me, but here is the script i made:
players = {}
local chosenplayer1 = nil
local chosenplayer2 = nil
local stringvalue = game.Workspace.Baseplate.event.Value
local serverstore = game:GetService("ServerStorage")
events = {"test"}
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 == "test" then
local value = players[math.random(1,#players)]
stringvalue = value
local char = game.Workspace:FindFirstChild(stringvalue)
print(char)
end
end
game.Players.PlayerAdded:Connect(onCharacterAdded)
game.Players.PlayerRemoving:Connect(OnCharacterRemoved)
ChooseEvent()

1 comment
very confusing to me, lolz