Advertisement
OnFireRobloxScriptin

Locked Gate Script

Oct 24th, 2023
614
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.53 KB | None | 0 0
  1. --// leaderstats (regular script in serverscriptservice)
  2.  
  3. local RemoteEvent = game.ReplicatedStorage:WaitForChild("Unlockwall") --Variable for RemoteEvent
  4.  
  5. --//leaderstats
  6. game.Players.PlayerAdded:Connect(function(player) --Run script when player joins the game
  7.     local leaderstats = Instance.new("Folder") --Create a new folder for leaderstats
  8.     leaderstats.Name = "leaderstats" --Names folder to "leaderstats"
  9.     leaderstats.Parent = player --Put folder under player
  10.    
  11.     local level = Instance.new("IntValue") --Create a new IntValue
  12.     level.Name = "Level" --Name it "Level"
  13.     level.Value = 0 --Set the starting value to 0
  14.     level.Parent = leaderstats --Put it under the leaderstats folder
  15.    
  16.     if level.Value >= 5 then --If the player's level Value is over or equal to 5, fire the RemoteEvent (If you have a datastore instead of leaderstats, don't delete this)
  17.         RemoteEvent:FireClient(player) --Fire RemoteEvent
  18.     end
  19.    
  20.     level:GetPropertyChangedSignal("Value"):Connect(function() --When the Level Value is changed
  21.         if level.Value >= 5 then --If the player's level Value is over or equal to 5, fire the RemoteEvent
  22.             RemoteEvent:FireClient(player) --Fire RemoteEvent
  23.         end
  24.     end)
  25. end)
  26.  
  27. --//Local Script under the player
  28.  
  29. local RemoteEvent = game.ReplicatedStorage:WaitForChild("Unlockwall")
  30.  
  31. RemoteEvent.OnClientEvent:Connect(function()
  32.     local wall = workspace.Statwall
  33.     wall.CanCollide = false
  34.     wall.BrickColor = BrickColor.new("Bright green")
  35. end)
  36.  
  37.  
  38. Watch the Full Video to set it up/learn how it works
  39. https://youtu.be/x4xEO192oPA
  40.  
  41.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement