there is no error codes in the output, but the code does not play my sound or deal damage, I’m fairly new to coding so the code may just be flat-out in the wrong format
local radioactiveZone = script.Parent
local damageRate = 3
local damageInterval = 3
local playerEntered = {}
local sound = Instance.new("Sound")
sound.SoundId = "rbxassetid://637072737"
sound.Volume = 1
sound.Parent = radioactiveZone
local function playSound()
sound:Play()
end
local function damagePlayers()
for player, _ in pairs(playerEntered) do
if player and player.Parent then
player:TakeDamage(damageRate)
end
end
end
local function onPlayerEntered(other)
if other:IsA("Player") then
playerEntered[other] = true
playSound()
end
end
local function onPlayerExited(other)
if other:IsA("Player") then
playerEntered[other] = nil
end
end
radioactiveZone.Touched:Connect(onPlayerEntered)
radioactiveZone.TouchEnded:Connect(onPlayerExited)
while true do
wait(3)
damagePlayers()
end