
I have a Russian Roulette mod on the workshop that previously would move players to spectate when they lost. I scrapped this behavior because after these players sat back down in their seats, their hand zones would stop working.
I have pasted the code below, and included a video demonstrating the problem. The offending line of code is “Player[player_color].changeColor(“Grey”)”
chamber = 0
cocked = false
function onLoad()
self.createButton({
label = "Begin",
click_function = "Begin",
function_owner = self,
position = { 0, 2, 0 },
rotation = { 0, 180, 0 },
height = 750,
width = 1500,
font_size = 450
})
end
function Begin()
broadcastToAll("The cylinder spins")
chamber = (math.random(1, 6))
self.clearButtons()
self.createButton({
label = "Prime",
click_function = "Prime",
function_owner = self,
position = { 0, 0, 4.5 },
rotation = { 0, 180, 0 },
height = 750,
width = 1500,
font_size = 450
})
end
function Prime(player_color)
cocked = true
broadcastToAll("The hammer clicks back")
self.clearButtons()
end
function onPickUp(player_color)
if cocked == true then
broadcastToAll((Player[player_color].steam_name) .. " prays")
end
end
function onDropped(player_color)
if cocked == true then
if chamber == 1 then
broadcastToAll((Player[player_color].steam_name) .. " was unlucky")
self.addTorque({ self.getTransformRight().x * 22.5, self.getTransformRight().y * 22.5,
self.getTransformRight().z * 22.5 })
self.addForce({ self.getTransformForward().x * 7.5 + self.getTransformUp().x * 7.5,
self.getTransformForward().y * 7.5 + self.getTransformUp().y * 7.5,
self.getTransformForward().z * 7.5 + self.getTransformUp().z * 7.5 })
Player[player_color].changeColor("Grey")
cocked = false
self.createButton({
label = "Begin",
click_function = "Begin",
function_owner = self,
position = { 0, 2, 0 },
rotation = { 0, 180, 0 },
height = 750,
width = 1500,
font_size = 450
})
else
chamber = chamber - 1
cocked = false
self.createButton({
label = "Prime",
click_function = "Prime",
function_owner = self,
position = { 0, 0, 4.5 },
rotation = { 0, 180, 0 },
height = 750,
width = 1500,
font_size = 450
})
broadcastToAll((Player[player_color].steam_name) .. " was spared")
end
end
end