Script Not Working

I have a script thats not working ive tried just about everything, my problem is the decal wont become visible after becoming invisible.

–Here’s the script

local Monster= game.Workspace.SpookyMonster
local OriginPosition = game.Workspace.SpookyMonster.Position.Z
local REACTIONTIME = 5

function GetRandomPosition(part)

local x=math.random(-50.156, -46.506)
local y=math.random(1.5,33.65)
local z=math.random(-129.493,-44.393)
return Vector3.new(x,y,z)

end

while true do
Monster.Position = GetRandomPosition()
task.wait(REACTIONTIME)
if Monster.Decal.Transparency ~= 1 then
print(“YOU LOST”)
elseif Monster.Decal.Transparency == 1 then
Monster.Decal.Transparency = 0
REACTIONTIME -= 1
end
end

–Im using a local script to make the parts decal transparent.

2 Likes

Are you sure its gonna be either 1 or 0? Also you only set the transparency once here:

and thats if its invisible, it goes visible.
Is there anything printing in the console?

1 Like

Are you trying to make a game here? I don’t understand.

But you could try this script I wrote;

local Monster = game.Workspace.SpookyMonster
local REACTIONTIME = 5
local Table
function GetRandomPosition()
	local x = math.random(-50.156, -46.506)
	local y = math.random(1.5, 33.65)
	local z = math.random(-129.493, -44.393)
	return Vector3.new(x, y, z)
end


function RNG  (random)
	Table = {
		"V1";          
		"V2";     --//Empty
		"V3";  -- 
		"V4";  --
		"V5";  --
	}
	
	random = Table[math.random(1, #Table)]
	return random
end



while true do
	local RN = RNG()
	Monster.Position = GetRandomPosition()
	if RN == "V1" then
		Monster.Decal.Transparency = 0
		print("YOU LOST" ..RN)
		break -- you can remove it if you want it to continue forever
	elseif RN == "V2" or "V3" or "V4" or "V5" then
		print("Skip" ..RN)
		Monster.Decal.Transparency = 1
		REACTIONTIME = math.max(0.3, REACTIONTIME - 1) -- this stops it at 0.3 after subtracting 1 from 5
	end

	task.wait(REACTIONTIME)
end

maybe it’s better to use RNG?
Screenshot 2024-03-02 151200

thanks for the help, ive been trying to figure this out for days!

1 Like

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