Problem with my script

How does the script look like now?

local bloomCharmixPin = game.Workspace:WaitForChild("BloomCharmixPin")
local floraCharmixPin = game.Workspace:WaitForChild("FloraCharmixPin")
local stellaCharmixPin = game.Workspace:WaitForChild("StellaCharmixPin")
local proxBloom = bloomCharmixPin:WaitForChild("default"):WaitForChild("ProximityPrompt")
local proxStella = stellaCharmixPin:WaitForChild("default"):WaitForChild("ProximityPrompt")
local proxFlora = floraCharmixPin:WaitForChild("default"):WaitForChild("ProximityPrompt")
local gui = script.Parent

proxBloom.Triggered:Connect(function()
	gui.Text += 6
	proxBloom.Parent.Parent:Destroy()
end)

proxStella.Triggered:Connect(function()
	gui.Text += 1
	proxStella.Parent.Parent:Destroy()
end)

proxFlora.Triggered:Connect(function()
	gui.Text += 1
	proxFlora.Parent.Parent:Destroy()
end)

if tonumber(gui.Text) == 6 then
	game.ReplicatedStorage.StellaMFCharmix:FireServer()
	game:GetService("StarterGui"):GetCore("ResetButtonCallback", false)
end

Currently the if statement is only running once, so as you correctly suggested you’ll need to use GetPropertyChangedSignal like so:

local bloomCharmixPin = game.Workspace:WaitForChild("BloomCharmixPin")
local floraCharmixPin = game.Workspace:WaitForChild("FloraCharmixPin")
local stellaCharmixPin = game.Workspace:WaitForChild("StellaCharmixPin")
local proxBloom = bloomCharmixPin:WaitForChild("default"):WaitForChild("ProximityPrompt")
local proxStella = stellaCharmixPin:WaitForChild("default"):WaitForChild("ProximityPrompt")
local proxFlora = floraCharmixPin:WaitForChild("default"):WaitForChild("ProximityPrompt")
local gui = script.Parent

proxBloom.Triggered:Connect(function()
	gui.Text += 6
	proxBloom.Parent.Parent:Destroy()
end)

proxStella.Triggered:Connect(function()
	gui.Text += 1
	proxStella.Parent.Parent:Destroy()
end)

proxFlora.Triggered:Connect(function()
	gui.Text += 1
	proxFlora.Parent.Parent:Destroy()
end)

gui:GetPropertyChangedSignal("Text"):Connect(function()
	if tonumber(gui.Text) == 6 then
		game.ReplicatedStorage.StellaMFCharmix:FireServer()
		game:GetService("StarterGui"):GetCore("ResetButtonCallback", false)
	end
end)

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