GUI script don't work

Hello,

So my goal is to check if the player has an island and the island’s number and teleport the player to the right island.

So i created a script that’s create a StringValue when the player join to the game. And the value is “False” (when the player don’t have an island)

And the player can get an island by walking trough this door:
https://gyazo.com/d089ff4adb5efa83a56f3f4a553a23c8

And i have a scirpt in the island wich is set the Status(StringValue) to "True(And the number of the island like here to1)

The first part of the script works because if the player doesn’t have an island (The Status value “False”) a message gui gets visible:
https://gyazo.com/b3dba7560f8163b1b7a6e7bb4a258982

But when the player have the “True1” Status value the button don’t work:
https://gyazo.com/37d4e964588d0dc9982acca7f86ee9b3

The localscript:

local player = game.Players.LocalPlayer

script.Parent.MouseButton1Click:Connect(function()
	if player.Status.Value == "False" then
		script.Parent.Parent.Warning.Visible = true
		wait(5)
		script.Parent.Parent.Warning.Visible = false
	elseif player.Status == "True1" then
		player.Character.UpperTorso.CFrame = CFrame.new(-193.131, 0, 103.073)
	end
end)

i’ just recently started scirpting

The problem is that you didn’t put player.Status.Value, so the if statement detects if the actual instance is an string, so the corrected script will be this:

local player = game.Players.LocalPlayer

script.Parent.MouseButton1Click:Connect(function()
	if player.Status.Value == "False" then
		script.Parent.Parent.Warning.Visible = true
		wait(5)
		script.Parent.Parent.Warning.Visible = false
	elseif player.Status.Value == "True1" then
		player.Character.UpperTorso.CFrame = CFrame.new(-193.131, 0, 103.073)
	end
end)
6 Likes

What Sarchyx said. :slight_smile:

If it still doesn’t work after that, there may be other mistakes in other scripts.