I’m trying to make this VHS TAPE player, but the code appears to not be working in my favor could someone help.
The issue could be with how I wrote the code, but I really don’t know.
I’ve tried changing some parts of the code and yet it won’t work.
local model = script.Parent
local Clicker = model.Clicker
local Play = model.Play
local Stop = model.Stop
local folder = model.Parent
local TapesFound = folder.CollectedTapes
local Activated = false
local Sounds = {
click = Play:WaitForChild(“Sound”, 5),
BackInTime = Clicker:WaitForChild(“BackInTime”, 5),
}
local ClickDetectors = {
PlayerClicker = Clicker:WaitForChild(“ClickDetector”, 5),
PlayCD = Play:WaitForChild(“ClickPlay”, 5),
StopCD = stop:WaitForChild(“ClickStop”, 5),
}
function FailedPlayer(player)
local plrgui = player:FindFirstChildOfClass(“PlayerGui”)
if plrgui then
local Message = Instance.new(“Message”)
Message.Text = “Find the tapes first.”
Message.Parent = plrgui
task.wait(5)
Message:Destroy()
end
end
function play()
if Activated then
Sounds.BackInTime:Resume()
end
end
function stop()
if Activated then
Sounds.BackInTime:Pause()
end
end
ClickDetectors.PlayerClicker.MouseClick:Connect(function(player)
if TapesFound.Value < 4 then
FailedPlayer(player)
elseif TapesFound.Value == 4 or TapesFound.Value > 4 then
Activated = true
Sounds.click:Play()
ClickDetectors.PlayCD.MaxActivationDistance = 15
ClickDetectors.StopCD.MaxActivationDistance = 15
ClickDetectors.PlayerClicker.MaxActivationDistance = 0
end
end)
ClickDetectors.PlayCD.MouseClick:Connect(play)
ClickDetectors.StopCD.MouseClick:Connect(stop)
