Skip to content

Instantly share code, notes, and snippets.

View RobertCodez's full-sized avatar
💻
Scripting In Lua

Depper RobertCodez

💻
Scripting In Lua
View GitHub Profile
@RobertCodez
RobertCodez / Leaderboard.lua
Last active July 30, 2021 16:42
Global Leaderboard Script
local DatastoreService = game:GetService("DataStoreService")
local SlimeStore = DatastoreService:GetOrderedDataStore("SlimeStore")
local ResetTime = 60
while wait(1) do
ResetTime = ResetTime - 1
if ResetTime == 0 then
@RobertCodez
RobertCodez / Archery.lua
Created July 30, 2021 16:41
Physics based archery system
ocal player = game.Players.LocalPlayer
local playerGUI = player:WaitForChild('PlayerGui')
local Mouse = player:GetMouse()
local RS = game:GetService("RunService")
local Debris = game:GetService("Debris")
local Handle = script.Parent.Handle
local Ammo = player.BowAmmo
local MaxAmmo = 20
@RobertCodez
RobertCodez / Codes.lua
Created July 30, 2021 16:42
Twitter Codes | Uses Datastores
local DataStoreService = game:GetService("DataStoreService")
local TwitterCodes = { Code1 = {"Cash", 2000} }
game.ReplicatedStorage.RedeemCode.OnServerInvoke = function(Player, Code)
local TwitterCodeStore = DataStoreService:GetDataStore("TwitterCodesStore2" .. Code)
local PlayerRedeemedCode = TwitterCodeStore:GetAsync(Player.UserId)
@RobertCodez
RobertCodez / Rank.lua
Created July 30, 2021 16:45
Team Based on rank in group | For RP games
game.Players.PlayerAdded:connect(function(newPlayer)
if newPlayer:GetRankInGroup(4131628) == 1 then
newPlayer.Team = game.Teams["Hotel Guest"]
newPlayer.TeamColor = game.Teams["Hotel Guest"].TeamColor
elseif newPlayer:GetRankInGroup(4131628) == 2 then
newPlayer.Team = game.Teams["Noted Guest"]
newPlayer.TeamColor = game.Teams["Noted Guest"].TeamColor
elseif newPlayer:GetRankInGroup(4131628) == 3 then
@RobertCodez
RobertCodez / Datastore.lua
Created July 30, 2021 16:47
Value Datastore | Saves the values such as coins in your game
local DataStoreService = game:GetService("DataStoreService")
local dataStore = DataStoreService:GetDataStore("SlimeStore")
local function saveData(player)
local SavedData = {
player.leaderstats.Slimes.Value;
@RobertCodez
RobertCodez / Camera.lua
Created July 30, 2021 16:51
Camera Maniuplation
local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack,false)
repeat wait() until plr.Character
local cam = game.Workspace.CurrentCamera
local zoom = 150
cam.FieldOfView = 10
cam.CameraType = Enum.CameraType.Scriptable
local rs = game:GetService("RunService")
@RobertCodez
RobertCodez / Arena.lua
Created July 30, 2021 16:57
Arena Invitations | Shows the use of remote events to provoke all the clients
game.ReplicatedStorage.JoinArena.OnServerInvoke = function(plr)
if plr:FindFirstChild("Arena") == nil then
Instance.new("BoolValue",plr).Name = "Arena"
plr.ChildRemoved:Connect(function(child)
if child.Name == "Arena" then
local amount = 0
local theWinner
for _,player in pairs(game.Players:GetPlayers()) do
if player:FindFirstChild("Arena") then
amount = amount + 1
@RobertCodez
RobertCodez / Proximity-prompts.lua
Created July 30, 2021 16:57
Proximity Prompts
local ProximityPromptService = game:GetService("ProximityPromptService")
local function onPromptTriggered(promptObject, player)
end
local function onPromptHoldBegan(promptObject, player)
end
@RobertCodez
RobertCodez / Fighting.lua
Created July 30, 2021 16:59
Pet Hatching, and Chicken fighting in Arena's
local plr = game.Players.LocalPlayer
local cam = workspace.CurrentCamera
local TS = game:GetService("TweenService")
local arenaInstructions = {"Welcome to the Wide Arena!", "Your chickens will battle against everybody else's Chicken!", "The winner will win a prize of 500 Coins!", "May the best Chicken win!"}
local impossible = false
local function cameraShake()
for i = 1, 20 do
@RobertCodez
RobertCodez / Saver.lua
Created July 30, 2021 17:01
Stage Saver
local myData = game:GetService("DataStoreService"):GetDataStore("CodezStore")
game.Players.PlayerAdded:Connect(function(plr)
local StagesOwned = Instance.new("Folder", plr)
StagesOwned.Name = "StagesOwned"
pcall(function()
local data = myData:GetAsync(plr.UserId)
for _, v in pairs(data) do
local newStage = Instance.new("BoolValue", plr.StagesOwned)
newStage.Name = v