Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Murder Game Not Working? Status not updating?

This murder script I made is working (but not updating the status.) The script inside the text label is a script, here is the code for it:

script.Parent.Text = game.ReplicatedFirst.Status.Value
game.ReplicatedFirst.Status.Changed:Connect(function()
	script.Parent.Text = game.ReplicatedFirst.Status.Value
end)

Here is the main script code.

wait(5)
local maps = game.Workspace:FindFirstChild('Map')
local Players = game.Players:GetChildren()
local murderer = game.Players:GetChildren(math.random(1, #Players))
local Innocent = game.Players:GetChildren()
local plrcount = 2
local status = script.Parent.Status
local EndRound = script.EndRound

--

local m = murderer
local i = Innocent

--

local Gamemodes = {"Classic"}
local KnifeSkins = {"Normal"}
local GunSkins = {"Normal"}
local Auras = {}
local CurrencyName = "CrazyPointz"
local CurrencyName2 = "CrazyTikz"

--Event things

local SpookyRounds = {}
local Eggs = {}
local Foods = {}

--

local Roundtime = 100
local IntermissionTime = 10

--Stats Adder

game.Players.PlayerAdded:Connect(function(plr)
	local ls = Instance.new("BoolValue",plr)
	ls.Name = 'leaderstats'
	local currency1 = Instance.new("IntValue",ls)
	local currency2 = Instance.new("IntValue",ls)
	currency1.Name = CurrencyName
	currency2.Name = CurrencyName2
end)

function Round()
	for i,v in pairs(game.Players:GetPlayers()) do
		v.Character.Humanoid.Jump = true
		v.Character.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(game.Workspace.Map.Mineshaft.Spawns.Spawn.Position.X,game.Workspace.Map.Mineshaft.Spawns.Spawn.Position.Y +5,game.Workspace.Map.Mineshaft.Spawns.Spawn.Position.Z))
	end
	script.Parent["Virtual Knife"]:Clone().Parent = murderer.Backpack
	local timer = 100
	repeat
		timer = timer -1
		status.Value = 'Round ('..timer..')'
		wait(1)
	until timer == 0
	status.Value = 'Round over!'
	EndRound.Value = true
end
--Intermission

function Intermission()
	local timer = 30
	repeat
		status.Value = 'Intermission ('..timer..')'
		wait(1)
		timer = timer -1
	until timer == 0
	status.Value = 'Picking murder...'
	wait(3)
	murderer = game.Players:GetPlayers(math.random(1, #Players))
	status.Value = 'Murderer Has Been Picked!'
	wait(4)
	status.Value = 'Round starting'
	wait(1)
	Round()
end
Intermission()
--Round



--Round end

EndRound.Changed:connect(function()
	if EndRound.Value == true then
		EndRound.Value = false
		for i,v in pairs(game.Players:GetPlayers()) do
		v.Character.Humanoid.Health = 0
	end
	game.SoundService.RoundEndMusic:Play()
	wait(5)
	Intermission()
	end
end)

Hope you can help.

5 comments

0

FIX: IS TELEPORTING PLAYERS

0

Check output for errors, if there are none it's either working (but not as you want) or not nut running. You can print something on line 1 to see if it is running. If it isn't running then it's either disabled or misplaced, you can check the wiki for the script types to see where they need to be to run.

0

Ok. No output on any of the scripts?

0

@Gullet please read the answers.

0

If you add a print on line 1 and it's not printing it's not running, they're either disabled or misplaced. Check the wiki for script and localscript to see where they need to be to run.

1 answer

Well, I've changed around some things and moved some stuff, everything works except from line 87 to line 102. Hope you can help.

print('Script is running!')
wait(5)
local maps = game.Workspace:FindFirstChild('Map')
local Players = game.Players:GetChildren()
local murderer = game.Players:GetChildren(math.random(1, #Players))
local Innocent = game.Players:GetChildren()
local plrcount = 2
local status = script.Parent.Parent.ReplicatedStorage.Status
local EndRound = script.Parent.Parent.ReplicatedStorage.EndRound

--

local m = murderer
local i = Innocent

--

local Gamemodes = {"Classic"}
local KnifeSkins = {"Normal"}
local GunSkins = {"Normal"}
local Auras = {}
local CurrencyName = "CrazyPointz"
local CurrencyName2 = "CrazyTikz"

--Event things

local SpookyRounds = {}
local Eggs = {}
local Foods = {}

--

local Roundtime = 100
local IntermissionTime = 10

--Stats Adder

game.Players.PlayerAdded:Connect(function(plr)
	local ls = Instance.new("BoolValue",plr)
	ls.Name = 'leaderstats'
	local currency1 = Instance.new("IntValue",ls)
	local currency2 = Instance.new("IntValue",ls)
	currency1.Name = CurrencyName
	currency2.Name = CurrencyName2
end)

function Round()
	for i,v in pairs(game.Players:GetPlayers()) do
		v.Character.Humanoid.Jump = true
		v.Character.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(game.Workspace.Map.Mineshaft.Spawns.Spawn.Position.X,game.Workspace.Map.Mineshaft.Spawns.Spawn.Position.Y +5,game.Workspace.Map.Mineshaft.Spawns.Spawn.Position.Z))
	end
	script.Parent.Parent.ReplicatedStorage["Virtual Knife"]:Clone().Parent = murderer.Backpack
	local timer = 10
	repeat
		timer = timer -1
		status.Value = 'Round ('..timer..')'
		wait(1)
	until timer == 0
	status.Value = 'Round over!'
	EndRound.Value = true
end
--Intermission

function Intermission()
	local timer = 30
	repeat
		status.Value = 'Intermission ('..timer..')'
		wait(1)
		timer = timer -1
	until timer == 0
	status.Value = 'Picking murder...'
	wait(3)
	murderer = game.Players:GetPlayers(math.random(1, #Players))
	status.Value = 'Murderer Has Been Picked!'
	wait(4)
	status.Value = 'Round starting'
	wait(1)
	Round()
end
Intermission()
--Round



--Round end
--Heres the bit that doesn't work, it doesn't error or print or anything!
EndRound.Changed:connect(function()
	print('End variable has changed')
	if EndRound.Value == true then
		print('End variable was called!')
		EndRound.Value = false
		for i,v in pairs(game.Players:GetPlayers()) do
		v.Character.Humanoid.Health = 0
		end
		print('Sucsessfully reset players.')
	game.SoundService.RoundEndMusic:Play()
	print('Sucsessfully played song')
	wait(5)
	Intermission()
	print('Sucsessfully started intermission')
	end
end)

2 comments

0

Then it means EndRound.Changed is never fired

0

There is something wrong with the Changed event recently. I was working with StringValues. Everytime I change its value, it never fires the Changed event

This discussion is preserved as it was. New answers, comments, and votes are closed.