wait so do i put the localscript inside the door?
yes
ignore this just for roblox minium characters lol
so would i put the door in workplace or starterplayerscripts?
workspace and the script inside the door
the localscript or just the script?
localscript
ignore this just for roblox minium characters lol
ok done that, but it still doesnt work for some reason?
can u show me ur roblox studio explorer pls?
i made some changes in the script and localscript try to copie again and tell me if it worked btw
can you show the script so i can copy pls?
sure
ignore this just for roblox minium characters lol
new script
server:
local datastore = game:GetService("DataStoreService"):GetDataStore("_GameExperience")
local SaveTable = {}
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder",player) -- create a leaderstats folder and parent to player
leaderstats.Name = "leaderstats"
local Level = Instance.new("IntValue",leaderstats) -- create the leaderstats level and parent to leaderstats
Level.Name = "Level"
local data
local sucess,err = pcall(function()
data = datastore:GetAsync(player.UserId)
end)
SaveTable["Currency"] = nil
if data then -- if a data exist in the player key
Level.Value = data["Currency"]
end
coroutine.wrap(function()
while wait(5*60) do -- Every 5 minutes gives 1 level
player.leaderstats.Level.Value += 1
end
end)()
end)
game.Players.PlayerRemoving:Connect(function(player)
if player then
SaveTable["Currency"] = player.leaderstats.Level.Value
datastore:SetAsync(player.UserId,SaveTable) -- Sets the current level value to key.
end
end)
client(local script):
local player = game.Players.LocalPlayer -- gets the client player
local Level = player.leaderstats:WaitForChild("Level") -- gets the level value
local UnlockLevel = ur unlock level -- ur door Unlock Level.
local door = script.Parent -- if u put inside the door
Connection = Level.Changed:Connect(function(newlevel)
if newlevel >= UnlockLevel then -- check if player newlevel = UnlockLeveç
if door.CanCollide then -- Check if the door was not already Open
door.CanCollide = false
else
Connection:Disconnect()
end
else
print("Levels to Unlock Door:"..(UnlockLevel-newlevel))
end
end)
lol my bad forgot the end in the server script now it should work
so what would i change in the end of the localscript in serverscriptservice to make it work?
before the “game.Players.PlayerRemoving” there is supposed to be 3 ends if the script have 2 add this “end)”
so would this be correct?
yes
ignore this just for roblox minium characters lol
no in the "while wait should be 5*60 cause its 60 seconds *5 minutes
so do i wait for five minutes and see if it unlocks?