So basically I’m making a game where you have to collect 3 crystals to close up a portal, every time you collect a crystal a value will go up by 1 (string value). The script to close up the portal is disabled by default. What im trying to do is, when the StringValue.Value reaches 3 ,the script for the portal will be disabled false. When the value is below 3 the script will stay disabled until the player finds the 3 crystals.
The problem is that it just doesnt work at all, the script stays disabled no matter what, i am a complete noob in scripting so i obviously must’ve made a crucial mistake. Anyways here’s the script:
local Status = game.ReplicatedStorage.DisplayValues.Status
game:GetService(“Players”).PlayerAdded:Connect(function(Player)
if Status.Value == 3 then
script.Parent.Disabled = false
elseif Status.Value ~= 3 then
script.Parent.Disabled = true
end
end)
(DisplayValues is a folder, status is the name of the stringvalue and the script shown here is a child of the script that closes the portal)
i have seen something on the dev forum with tables, but I couldn’t get it to work either. I dont even know if im using the right value for this