Hello, so I have a script that I want to open a frame only if you have 1 or more lives. If you dont, it will prompt an error message. What is wrong with my script? It only prompts the error message even though I have 500 lives.
local playButton = script.Parent.Start
local players = game:GetService("Players")
local localPlayer = players.LocalPlayer
local lives = localPlayer.playerstats.Lives.Value
local playFrame = game:GetService("StarterGui").Frames:WaitForChild("PlayFrame")
local frameTrigger = require(game:GetService("StarterGui"):WaitForChild("FrameTrigger"))
playButton.MouseButton1Click:Connect(function()
if lives >= 1 then
frameTrigger.OpenFrame("PlayFrame")
else
script.Parent.Parent.Error.Visible = true
task.wait(5)
script.Parent.Parent.Error.Visible = false
end
end)
local playButton = script.Parent.Start
local players = game:GetService("Players")
local localPlayer = players.LocalPlayer
local lives = localPlayer.playerstats.Lives
local playFrame = game:GetService("StarterGui").Frames:WaitForChild("PlayFrame")
local frameTrigger = require(game:GetService("StarterGui"):WaitForChild("FrameTrigger"))
playButton.MouseButton1Click:Connect(function()
if lives.Value >= 1 then
frameTrigger.OpenFrame("PlayFrame")
else
script.Parent.Parent.Error.Visible = true
task.wait(5)
script.Parent.Parent.Error.Visible = false
end
end)