#World Gate Properties

12 messages · Page 1 of 1 (latest)

native bay
#
local workspace = game:GetService("Workspace")
local gate = workspace:WaitForChild("GateWorld1")
local Player = game.Players.LocalPlayer
local hiddenData = Player:WaitForChild("hiddenData")
local unlockedWorld = hiddenData:WaitForChild("unlockedWorld")

game.Players.PlayerAdded:Connect(function()
    if unlockedWorld.Value > 1 then
        gate.CanCollide = false
        gate.Transparency = 1
    end
end)

this script is in StarterPlayer > StarterPlayerScripts, and it's supposed to "open" the Gate to the next world for the player, if he has unlocked it. The "Gate" stays the same tho, even if unLockedWorld is more than 1

#

Script is a LocalScript

worn crane
#

i dont know how to solve it but id suggest adding print("") around the script to see what it got to before failing

native bay
elder marsh
#

Instead of doing this, just fire an event when a new world is unlocked to unlock said gate

#

and use datastores to store which worlds are unlocked for the player

native bay
native bay
#

basically if the players unlockedWorld = 5 i wanted to unlock the first 5 gates when the player joins

#

that way I can save all of the player's unlocked worlds with 1 value

native bay
#

@elder marsh
The function doesnt work at all for some reason, I did this debugging: and nothing was printed

game.Players.PlayerAdded:Connect(function()
    print("1")
    if unlockedWorld.Value == 6 then
        print("2")
        gate.CanCollide = false
        print(gate.CanCollide)
        gate.Transparency = 1
        print(gate.Transparency)
    end
end)
#

Fixed it. It was because of the PlayerAdded in a local script