Making a jumpscare every time a value = a specific number or when a proximity prompt = enabled

Hello devs ! I am actually working on a horror game , and i have maid a script but he doesn’t workt and i need your help !

Context : In my game , somes events can appear and actually i need help on the “jumpscare event”. So , when the event start , the player have 25second the turn off a radio , if he don’t turn off the radio , all player’s on the server get a jumpscare . But if the event re appear after 25second , the jumpscare won’t work and all players won’t be killed.

Here is the main script " i only put the jumpscare event "

TableauCouple = function()
		print("TableauCouple")
		
		local red = Color3.new(0.658824, 0.0196078, 0.0196078)
		local EvilPic = game.ServerStorage.Events.ImagePartEvil:Clone()
		local BasicPic = game.Workspace.Evenements.Tableau.TableauCouple.ImagePart
		local Value = game.Workspace.Evenements.Radio.Neon.Value
		local prox = game.Workspace.Evenements.Radio.ProxPart.ProximityPrompt
		
		
		local HighLight = game.Workspace.Evenements.Radio.Highlight
		local Omg = game.Workspace.Evenements.Radio.TurnRadio.Arrows
		
		BasicPic.Decal.Transparency = 1
		EvilPic.Parent = game.Workspace
		
		HighLight.Enabled = true
		Omg.Enabled = true
		game.Workspace.Evenements.Tableau.TableauCouple.ImagePart.Decal.Transparency = 1
		game.Workspace.Evenements.Light.Model.TableauLightStand.LightFixture.Neon.Color = red
		game.Workspace.Evenements.Light.Model.TableauLightStand2.LightFixture.Neon.Color = red
		
		game.Workspace.Evenements.Light.Model.TableauLightStand.LightFixture.PointLight.Color = Color3.new(0.658824, 0.0196078, 0.0196078)
		game.Workspace.Evenements.Light.Model.TableauLightStand2.LightFixture.PointLight.Color = Color3.new(0.658824, 0.0196078, 0.0196078)
		
		game.Workspace.Evenements.Radio.Neon.Color = red
		game.Workspace.Evenements.Tableau.TableauCouple.Light.PointLight.Enabled = true
		game.Workspace.Evenements.Radio.Neon.Transparency = 0
		game.Workspace.Evenements.Radio.Neon.Sound.SoundId = "rbxassetid://1840493961"
		game.Workspace.Evenements.Radio.Neon.Sound:Play()
		
		prox.Enabled = true
		
		repeat
			wait(0.1)
			
		until Value.Value <= 2
		
		
		if Value.Value == 1 then -- Event stop / No jumpscare / no death
			print("Basic Restored")
			
			local Basic = Color3.fromRGB(195, 161, 141)
			
			game.Workspace.ImagePartEvil:Destroy()
			game.Workspace.Evenements.Tableau.TableauCouple.ImagePart.Decal.Transparency = 0
			game.Workspace.Evenements.Light.Model.TableauLightStand.LightFixture.Neon.Color = Basic
			game.Workspace.Evenements.Light.Model.TableauLightStand2.LightFixture.Neon.Color = Basic

			game.Workspace.Evenements.Light.Model.TableauLightStand.LightFixture.PointLight.Color = Color3.fromRGB(235, 167, 98)
			game.Workspace.Evenements.Light.Model.TableauLightStand2.LightFixture.PointLight.Color = Color3.fromRGB(235, 167, 98)

			game.Workspace.Evenements.Radio.Neon.Transparency = 1
			game.Workspace.Evenements.Tableau.TableauCouple.Light.PointLight.Enabled = false
			
		
			game.Workspace.Evenements.Radio.Neon.Sound:Stop()
			
			prox.Enabled = false
			Value.Value = 3
			HighLight.Enabled = false
			Omg.Enabled = false
		
		
		else if Value.Value == 2 then -- Event when seconds have been reach / event that kill everyone
			print("Killed")
			
			
				local cameraInterpolateEvent = game.ReplicatedStorage.RemotesScreamer.PaintCouple.cameraInterpolateEvent
				local cameraToPlayerEvent =  game.ReplicatedStorage.RemotesScreamer.PaintCouple.cameraToPlayerEvent
				
				local monster = game.ReplicatedStorage.Monster:Clone()
				monster.Parent = game.Workspace
				monster.Head.Scream:Play()
				cameraInterpolateEvent:FireAllClients(game.Workspace["Cameras Screamer"].FirstScreamer.CameraPosition.CFrame,game.Workspace["Cameras Screamer"].FirstScreamer.CameraAim.CFrame,0.2)
				wait(0.6)

				local c = game.Players:getChildren()
				for i = 1,#c do
					if (c[i].Character ~= nil and c[i].Character.Humanoid ~= nil) then
						c[i].Character.Humanoid.Health = c[i].Character.Humanoid.Health - 100
					end

					wait(0.6)
					
					cameraToPlayerEvent:FireAllClients()
					monster:Destroy()
					
					local Basic = Color3.fromRGB(195, 161, 141)

					game.Workspace.ImagePartEvil:Destroy()
					game.Workspace.Evenements.Tableau.TableauCouple.ImagePart.Decal.Transparency = 0
					game.Workspace.Evenements.Light.Model.TableauLightStand.LightFixture.Neon.Color = Basic
					game.Workspace.Evenements.Light.Model.TableauLightStand2.LightFixture.Neon.Color = Basic

					game.Workspace.Evenements.Light.Model.TableauLightStand.LightFixture.PointLight.Color = Color3.fromRGB(235, 167, 98)
					game.Workspace.Evenements.Light.Model.TableauLightStand2.LightFixture.PointLight.Color = Color3.fromRGB(235, 167, 98)

					game.Workspace.Evenements.Radio.Neon.Transparency = 1
					game.Workspace.Evenements.Tableau.TableauCouple.Light.PointLight.Enabled = false


					game.Workspace.Evenements.Radio.Neon.Sound:Stop()

					Value.Value = 3
					prox.Enabled = false
					HighLight.Enabled = false
					Omg.Enabled = false

				end
			end
		end
	end,

Here is also the script for the timer ( this script is on the main script )

local value = game.Workspace.Evenements.Radio.Neon.Value
local prox = game.Workspace.Evenements.Radio.ProxPart.ProximityPrompt



if prox.Enabled == false then

repeat
	
	wait(0.1)
	print("Waiting Paint ")
	
until prox.Enabled == true

wait(5) -- timer before death ( for test put 5s )

value.Value = 2
prox.Enabled = false	
	
	print("killed")
	
	
end

anyone have a solution?

just asking, does the value reset to 0 ?

No bcs the “default” value is “3”

i dont really know how to read correctly your script, since but i think you could use value.changed or smth like that, just saying

Actually i tried smth like that :

local Value = game.Workspace.Evenements.Radio.Neon.Value
local prox = game.Workspace.Evenements.Radio.ProxPart.ProximityPrompt
local ReValue = game.Workspace.Evenements.Radio.Value




while true do
	print("Test")
	
if prox.Enabled == true then
		
	wait(5)
		
	Value.Value = 2
	
elseif ReValue.Value == 5 then
	
	repeat
		wait(0.1)

		until prox.Enabled == true
		
	end
end

But now , when the event is “loaded” the wait() is not working and that kill instantly all players…

do prox.Changed instead? eeeeeee

Actually no , bcs when the event is over , the prox is disabled . The prox is visible only when the event start , so normally the wait need to work hm…

can u show me a video of whats making the issue?(if you can show it or not)

maybe you can do wait(0.5) value.Value = 3 after the print(“killed”), if that already happens uhhh i dont Know

here is the event when he is loaded for the first time :

and here is when the event is loaded for a second time :

i dont get the second one, what it was supposed to happen

you see when the event is loaded for the second time , the print “killed” appear instantly but normally , the script need to wait 5s before print “killed” and kill everyone

ohhhh now i get it, let me try to think

i think you should disable the script and then eanble it when its the second time (i mean the part where the death script is

1 Like

Okay now it works , i have disabled the script who are activating the value changing making the death of everyone , and now , when the event is loaded the script is Enabled and if they don’t press the prox , they got killed , but if they press it they won’t die and the game continue , and that work at infinite.

so tnks to your help and having reminded me that we can disabled a script fr i forgot this thing fr

did it work? if yes then this is my first time getting a solved

1 Like

yayyyy i did not expect that yayayaay

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.