If statement with a string inside *bug*

Ahoy everyone, I’m working on a game and I have this weird bug where I’m trying to use a if statement with a string inside but the script doesn’t work.

Provide an overview of:

  • if script.Parent.TasksDone.Text == text3 then
    claimButton.Visible = true
    end

This is not diagnosable. Post the rest of the script.

Sorry about that one "local task1 = script.Parent.Task1
local tasksDone = script.Parent.TasksDone
local player = game.Players.LocalPlayer
local inventoryButton = game.StarterGui.PC.PlacementUi.InventoryButton
local claimButton = script.Parent.ClaimButton
local tasksDone = false

local text1 = “Open the inventory”

local text2 = “0/1 done”

local text3 = “1/1 done”

task1.Text = text1
script.Parent.TasksDone.Text = text2

if script.Parent.TasksDone.Text == “1/1 done” then
claimButton.Visible = true
end

script.Parent.ClaimButton.MouseButton1Click:Connect(function()
local amount = 20 – put the amount of money you wan’t the player to get
game.Players.LocalPlayer.leaderstats.Cash.Value = game.Players.LocalPlayer.leaderstats.Cash.Value + amount
end)"

youre using ” instead of " try replacing

what do you mean by “try replacing” I’m just trying to understand what you mean.

local tasksDone = script.Parent.TasksDone
local player = game.Players.LocalPlayer
local inventoryButton = game.StarterGui.PC.PlacementUi.InventoryButton
local claimButton = script.Parent.ClaimButton
local tasksDone = false

local text1 = "Open the inventory"

local text2 = "0/1 done"

local text3 = "1/1 done"

task1.Text = text1
script.Parent.TasksDone.Text = text2

if script.Parent.TasksDone.Text == "1/1 done" then
	claimButton.Visible = true
end

script.Parent.ClaimButton.MouseButton1Click:Connect(function()
	local amount = 20
	game.Players.LocalPlayer.leaderstats.Cash.Value = game.Players.LocalPlayer.leaderstats.Cash.Value + amount
end)

thing is youre using instead of ", for strings you either gotta use "string" or 'string'

“text_1“ = :x:
"text_1" = :white_check_mark:
'test_1' = :white_check_mark:

It still doesn’t make the text button appear when the text is ‘test_1’

I’m confused at what isn’t working.

when ever the text of the text label is ‘1/1 done’ then a text button is suppose to become visible

well if script.Parent.TasksDone.Text isnt on “1/1 done” on default you gotta loop it

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