So I have a Murder-Mystery style game, and this is currently the last thing I need to do before rounds are complete. So I'm trying to make it, that whenever a TextLabel is changed, a frame blocking out the inventory disappears, and the open inventory frame opens up, and you get teleported. The Teleportation is working fine, but the inventory blocker and the inventory opener isn't working. Does anyone have any idea why this isn't working? (The Only thing relating to the blocker and opener is on lines: 9,10, 14 15) Script:
game.Players.PlayerAdded:Connect(function(player)
while true do
local Tab = {CFrame.new(-907, 5.4, -307); CFrame.new(-708, 73.4, -338); CFrame.new(-719, 73.4, -243); CFrame.new(-696, 55.4, -288); CFrame.new(-747, 6, -279); CFrame.new(-650, 5, -294); CFrame.new(-712, 8.6, -193); CFrame.new(-903, 5, -425); CFrame.new(-902, 8.6, -176); CFrame.new(-679, 55.4, -366); CFrame.new(-768, 60.2, -394); CFrame.new(-673, 38.6, -373); CFrame.new(-726, 38.6, -253); CFrame.new(-727, 55.4, -330)}
local locationselected = Tab[math.random(1, #Tab)]
local Spawnplates = {CFrame.new(19.511, 18.27, -42.511); CFrame.new(-31.86, 18.069, -18.085); CFrame.new(36.297, 19.375, -23.067); CFrame.new(-23.937, 18.17, -34.292); CFrame.new(-7.526, 18.27, -45.252); CFrame.new(-31.86, 18.069, -18.085); CFrame.new(37.096, 18.471, 9.724); CFrame.new(-35.261, 18.471, 2.364); CFrame.new(19.511, 18.27, -42.511)}
local spawnselected = Spawnplates[math.random(1, #Spawnplates)]
player.PlayerGui:WaitForChild("statusbar").TextLabel.Changed:Connect(function()
game.Workspace:WaitForChild(player.Name).Head.CFrame = locationselected
player.PlayerGui:WaitForChild("Inventory").openinv.Visible = true
player.PlayerGui:WaitForChild("Disabled").TextLabel.Visible = false
end)
player.PlayerGui:WaitForChild("statusbar").TextLabel.Changed:Connect(function()
game.Workspace:WaitForChild(player.Name).Head.CFrame = spawnselected
player.PlayerGui:WaitForChild("Disabled").TextLabel.Visible = true
player.PlayerGui:WaitForChild("Inventory").openinv.Visible = false
end)
wait()
end
end)

1 comment
You shouldn’t handle GUI coding from the server.