#Level Door Help

105 messages · Page 1 of 1 (latest)

rapid hamlet
#

I want to make a door that requires a certain level or stats for it to be open to only that player and i've looked everywhere and i can either find scripts that don't work or scripts that open the door for everyone can someone help please?

#

so a door like this where you have to have a certain number of wins to go though

velvet lily
#

Just check on touch for their level and if they have it, un-collide, but only on the client.

rapid hamlet
velvet lily
#

A local script, if you want to be really primitive put one inside of starterplayer and reference the door in workspace.

#

As far as I know, the StarterPlayer folder only fires once to be created when a player joins the game.

rapid hamlet
#

no but a local script doesnt work like that i swear

#

bc it cannot see workspace

#

as they need to own it ive tried that already

velvet lily
#

They're literally inside of workspace

#

Workspace is visible to client and server.

#

Whatever the client does in workspace

#

OTHER clients will NOT see

#

Only that client will.

#

But if you do it on the server, every client will see it.

#

You could call the client, from the server, to then run the script.

#

Which would be ideal.

rapid hamlet
#

you get the error Part is not a valid member of Workspace "Workspace" when running this code

local MoonDoor = game.Workspace.Part

local player = game.Players.LocalPlayer
local ls = player:WaitForChild("leaderstats")--Get's the leaderstats
local wins = ls:WaitForChild("Wins")


while wait() do
    if wins.Value <= 10 then --MoonDoor
        MoonDoor.CanCollide = false
        MoonDoor.Transparency = 0.5
    end
end

#

unless this is just me but everything is fine

velvet lily
#

:WaitForChild

#

TheScript runs on player load, not world/character load

#

So WAIT for the part to be loaded, and then it will work. If it doesn't, it will 'infinitely' yield

rapid hamlet
#

infinite yield

vapid ivy
#

put local script inside a part ;-; ?

velvet lily
#

Where is part

velvet lily
rapid hamlet
velvet lily
#

A script for every single part?

#

How will you make changes if you have 10 parts

rapid hamlet
#

i showed you in image

rapid hamlet
velvet lily
#

Where is part

#

IN THE WORLD

rapid hamlet
#

wym in the world

velvet lily
#

Have you tried testing, then checking if part is still in wokspace?

#

Workspace is everything you see in the 3d world

rapid hamlet
#

i mean when i play its there

vapid ivy
#
print(MoonDoor)
velvet lily
#

It won't be able to run

bold charmBOT
#

studio** You are now Level 6! **studio

velvet lily
#

It is infinitely yielding the code below it from running

#

That is what infinite yield possible means

rapid hamlet
velvet lily
#

Sometimes that runs because it took a little while to load

#

Meaning it yields and then stops after a little

rapid hamlet
velvet lily
#

Because the part HAS TO LOAD

rapid hamlet
#

it has

velvet lily
#

Think of the script

rapid hamlet
#

yes

#

but its priting that it has

velvet lily
#

Because it waited

#

and waited

#

and waited

#

and then suddenly loaded the part

#

And then once loaded, code under it runs

#

why tf are you doing a while loop

#

Just check on signal

#
MoonDoor.Touched:Connect(function()
    if wins.Value <= 10 then --MoonDoor
        MoonDoor.CanCollide = false
        MoonDoor.Transparency = 0.5
    end
end)
rapid hamlet
#

wait

#

i done it

#

tf

velvet lily
#

You're wasting so many resources using a while loop

#

aka it builds up and you lag

rapid hamlet
#

but it needs to see

#

it

velvet lily
#

bro it can see it

#

IT SEES IT IN A WHILE LOOP?

rapid hamlet
#

but its on touch

velvet lily
#

It only needs to check once

rapid hamlet
#

no

velvet lily
#

For when they touch, for it to turn on

rapid hamlet
#

the value is increasing

velvet lily
#

Then its on for ever

rapid hamlet
#

they need to be able to see visally

velvet lily
#

It doesn't matter if it increases??

rapid hamlet
#

yes

#

visally

velvet lily
#

You're always setting it to canCollide false, IF they have wins.Value <= 10

vapid ivy
#
wins:GetPropertyChangedSignal("Value"):Connect(function()
    if wins.Value <= 10 then --MoonDoor
        MoonDoor.CanCollide = false
        MoonDoor.Transparency = 0.5
    end
end)
rapid hamlet
#

ahh

bold charmBOT
#

studio** You are now Level 7! **studio

rapid hamlet
#

yes

#

that would work

velvet lily
vapid ivy
#

...

velvet lily
#

It only needs to fire once

#

But it won't fire until that value

rapid hamlet
#

no

velvet lily
#

So they can lose wins?

rapid hamlet
#

yes

#

and gain

velvet lily
#

Then say that

#

num nut

rapid hamlet
#

well i though it was obouis

#

its wins

#

why wouldnt it go up and down

velvet lily
#

bro who tf doesnt count losses

#

and instead only wins up and down

rapid hamlet
#

yes wins go up and down

velvet lily
#

good luck

rapid hamlet
#

thanks