I’m working on a game where you got find a monster on your screen in a certain amount of time and everything works but whenever the loop restarts the decal doesn’t became visible again.
–Here’s the script
local Monster= game.Workspace.SpookyMonster
local OriginPosition = game.Workspace.SpookyMonster.Position.Z
local ReactionTime = 20
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
print(“repeat”)
Monster.Position = GetRandomPosition()
task.wait(ReactionTime)
if Monster.Decal.Transparency == 1 then
ReactionTime -= 0.5
Monster.Decal.Transparency = 0
else
game.Workspace.b.CanCollide=false
print(“LOST”)
end
end
local i = 0
while true do
i = i + 1
print(“repeat”)
Monster.Position = GetRandomPosition()
task.wait(ReactionTime)
if Monster.Decal.Transparency == 1 then
ReactionTime -= 0.5
if i == 1 then
Monster.Decal.Transparency = 0
end
else
game.Workspace.b.CanCollide=false
print(“LOST”)
end
end
– The issue is because your setting the transparency of the decal to 1 each time the loop alliterates
local i = 0
while true do
i = i + 1
print(“repeat”)
Monster.Position = GetRandomPosition()
task.wait(ReactionTime)
ReactionTime -= 0.5
if i >= 1 then
Monster.Decal.Transparency = 0
end
end