Hi, I want to try to make a unlocking system that (if the player have amount of level, the player can get a gui that have its purpose of uses). But I don’t know how to make one. I ask for help on make one. I will appreciated, this is my script that I have tried to make this is just a example.
unlocking system (server script service)
local player = game.Players.PlayerAdded
local level = Instance.new("IntValue", player)
level.Name = "level"
level.Value = 0
local xp = Instance.new("IntValue", player)
xp.Name = "Exp"
xp.Value = 0
local max = Instance.new("IntValue", player)
max.Name = "MaxExp"
max.Value = 1
player:Connect(function(v)
if v.PlayerGui then
if xp.Value >= 100 or level.Value >= max.Value then
local open = v.PlayerGui:WaitForChild("stats system"):WaitForChild("menu system"):WaitForChild("menu"):WaitForChild("co op").unlock
local Descendant = game.Players:GetDescendants()
Descendant{open}
end
end
end)
gui local script (StarterGui)
local open = script.Parent
local re = game.ReplicatedStorage.RemoteEvent
local unlock = script
unlock.DescendantAdded:Connect(function(visible)
print("value reach")
open.Visible = true
end)
sry but the script doesn’t truly work, its just a example of my work on trying make the unlocking system. I’m here ask for help if someone the can make a work script. cuz this system script is to hard for its been 3 days on trying to make this work, so I’m right ask for help. I will appreciated if someone will help make the script
-- we create the player when they join.
local player = game.Players.PlayerAdded:Connect(function(player)
-- setting up leaderstats for the player.
local leaderstats = Instance.new('Folder')
leaderstats.Parent = player
leaderstats.Name = "leaderstats"
-- setting the level.
local level = Instance.new("IntValue", player)
level.Name = "level"
level.Value = 0
level.Parent = leaderstats
-- setting xp.
local xp = Instance.new("IntValue", player)
xp.Name = "Exp"
xp.Value = 0
xp.Parent = leaderstats
-- setting maxxp.
local maxxp = Instance.new("IntValue", player)
maxxp.Name = "MaxExp"
maxxp.Value = 1
maxxp.Parent = leaderstats
-- checking to see if player.playergui is real.
if player.PlayerGui then
local rep = game.ReplicatedStorage
local event = rep.RemoteEvent
-- checking xp value, and the rest of values, if they match then
print('checking sir.')
xp:GetPropertyChangedSignal('Value'):Connect(function()
if xp.Value >= 100 then
local open = player.PlayerGui["stats system"]["menu system"]:FindFirstChild('menu')
if open then
event:FireClient(player)
end
end
end)
end
end)
– Local Script.
local OpenSir = script.Parent
local rep = game.ReplicatedStorage.RemoteEvent
rep.OnClientEvent:Connect(function(player)
print("value reach")
OpenSir.Visible = true
end)
– Make a new Server Script, under the other server script in-which is above, and then paste this code into it, and you should be good.
game.Players.PlayerAdded:Connect(function(player)
local xp = player:WaitForChild('leaderstats'):FindFirstChild('Exp')
-- this is so you can get xp going up.
while true do
task.wait(1)
xp.Value = xp.Value + 1
end
end)
ok there’s something wrong, there’s no error idk what’s wrong with the script but I think cause was the script here isn’t finding the gui that is (inside a file and 2 more frame).the remote event idk really know, I just test it to make the server script service connect to the local script that is inside the gui.
-- this is purely for your remote event, which is what I'm assuming you tried to do inside of local script?
local rep = game:GetService('ReplicatedStorage')
local event = rep.RemoteEvent
-- checking xp value, and the rest of values, if they match then
if xp.Value >= 100 or level.Value >= maxxp.Value then
local open = player.PlayerGui["stats system"]["menu system"]:FindFirstChild("menu")["co op"].unlock
if open then
event:FireClient(player)
local opengui = script.Parent
local rep = game.ReplicatedStorage.RemoteEvent
-- don't exactly know how this is referenced so you can change it how you need.
local unlock = script
rep.OnClientEvent:Connect(function(player)
if player then
print("value reach")
opengui.Visible = true
end
end)
Can you show me a screenshot of what your PlayerGui looks like so I have a better Idea of how it should connect? I am purely going off of your original statement, Would be beneficial to me to see how your entire PlayerGui looks to better understand and help you.
the coop is the button for the coop system. soo the thing that need to be unlock is the coop button, not the coop system. and I assume you meant by unmarked that meant by the red line. right?
So, I’m assuming from the looks of it, that you just want the server script to open the GUI/Frame for the player correct? then you want that local script to active some sort of function when the button is clicked? Other wise I don’t understand the point of having the local script?.
– P.S Updated my Server Script that I posted above, We have to ensure that the GUI is not enabled before enabling the GUI, once it’s enabled you will be able to see it and interact with it as you please.
ok, the the server script supposedly make the text button visible turn to true and the unlock script is the connection script that connect the server script signal that the player have require the amount of level needed to make the button visible turn to true. the thing that the player can unlock is the text button. soo they can accessed the (coop system/coop menu).
that all. sry if i my explanation isn’t that clear
It’s alright ryan, I went ahead and updated my Server Script, and the Local script please try to use them both and let me know if you encounter anymore errors
hey the all of the script work but… can you tried to change it to make it all still level up cause when you reach the amount of xp to level up and unlocking the system, the xp unable to continue on and that meant the player cant continue leveling up. greedily appreciated for your time and work.
Went ahead and fixed it for you ryan, simply scroll back up to my original post of the scripts and read how to implement the new script, Hopefully all works out for you!
If this solved it fully for you, don’t forget to click ‘Solved’ incase anyone else may have this problem in the future!
[P.S] Don’t forget to implement the new server script as well, as it’s been updated from the old one!