I am using the following code:
function FreezePlayer(player)
local torso = player:FindFirstChild("Torso")
if (torso) then
torso.Anchored = true
end
end
function OnKillingStateStarted()
UpdateGameState()
if (repFreezable.Value and state == GameState.Chasing) then
repFreezable.Value = false
repGameState.Value = GameState.Killing
-- Freeze all survivors.
contestants:ForEach(function(player)
if (player ~= bloxxer) then
FreezePlayer(player)
end
end)
freezeTimer:Restart()
freezeCooldownTimer:Restart()
end
end
And the code does nothing. The little guys still walk around and ignore my code. I'm wondering if I should hit them.
: Tkdriverx Thanks for the reply.
I'm trying to pull out each player (default method) I use ForEach in other situations and it seems to work fine... The code below works fine for spawning.
local useableSpawns = List(officeSpawns)
players:ForEach(function(player)
local character = player.Character
if (character) then
local humanoid = character:FindFirstChild("Humanoid")
local torso = character:FindFirstChild("Torso")
local spawn = useableSpawns:Choose()
local spawnPos = spawn.Position
if humanoid and torso then
humanoid.Health = 100
humanoid.WalkSpeed = 16
torso.CFrame = CFrame.new(spawnPos.x, 5, spawnPos.z)
useableSpawns:Remove(spawn)
end
end
end)

1 comment
I think this is what you need http://wiki.roblox.com/index.php?title=Controlling_a_Player%27s_Character