I have ten parts, or barriers, blocking levels I’ve made so that when they aren’t unlocked, people can’t play them. I want to make it so that when a level is unlocked, such as level 3 for example, the corresponding part for level 3 and all the levels before that will show that it’s unlocked with the text I have and allow for a UI to appear when you walk up to it. How can I do this?
you can use localscript
check when player level ups and when it reaches the certain level you can unlock it by Uncollide the barrier or something like that to unblock player from going in
and use script
to check if player actually reach the certain level that they are in to prevent exploiter
like if player.level < currentlevel.levelrequired
then just oof them lol
You can also use collision groups if you want to get advanced.
I did this in a regular script and it works
local player = game.Players.PlayerAdded:Wait()
while wait() do
if player.leaderstats.Level.Value >= 1 then
script.Parent.Barrier.CanCollide = false
end
end
Yeah but it will unlock barrier for other players too, so you have to do it in localscript
local Player = game.Players.LocalPlayer
local leaderstats = Player:WaitForChild('leaderstats')
leaderstats.Level.Changed:Connect(function(v)
if v >= 1 then
workspace.Barrier.CanCollide = false
end
end)
Where do I put the local script I wanted to have the script in the level part itself
put it in StarterGui or StarterCharacter
localscript doesn’t work in workspace
game.Workspace.Levels["Level 1"].Barrier.Locked.SurfaceGui.Complete.Text = ("Walk up to this level to play.")
I tried this to set the text instead of cancollide and idk why its not working
you have to set cancollide to false to actually make player able to walk through it but you can add this line later
ok Im trying other ways and I think theyre working cause I never actually wanted to make can collide false that was just an example but thank you
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.