Elips Games - Commissions!

Who Am I:
Hello! I’m a young scripter from the USA!

Commission Wait Times:
Short commissions could take as little as a day. Long commissions would typically take about a week on average, but this depends on the commission, so it might take more or less time.

Commission Costs:
I personally will undercut most developers by 10% or more! Short commissions will most likely cost between 1000 to 2500 Robux. Long commissions will really depend on the length but probably range from 2500 Robux to 10000 Robux.

How To Contact Me:
You can either directly message me on the dev forum or message me through Discord.

My Work:

Why You Should Hire Me:
I’m very flexible in my work, and if you want me to change or add something to the commission, I can. If you dislike the product and want me to do something to make it better, just let me know! :blush:

Check this out if you’re wondering what the State of Nature is!

If you have any questions, let me know!

Here is the script for the bowling demo! This is an older project and isn’t my absolute best work as it’s highly unoptimized. It is also extensively annotated to make it easier to understand, but unfortunately, this makes it harder to read through.

local datastoreservice = game:GetService("DataStoreService") -- Gets Data Store Service
local MarketplaceService = game:GetService("MarketplaceService") -- Gets MarketPlaceService
local BallsStore = datastoreservice:GetDataStore("Balls.") -- Creates a data stpre
game.Players.PlayerAdded:Connect(function(Player) -- Detects When A Player Enters The Game
	Player.CharacterAppearanceLoaded:Connect(function(character) -- Detects When A Players Appearence Loads
		for i , v in pairs(character:GetDescendants()) do -- Goes Through All Of The Players Character
			if v:IsA("BasePart") or v:IsA("UnionOperation") or v:IsA("MeshPart") then -- Checks If Its A Part That Casts Shadow
				v.CastShadow = false -- Disables Cast Shadow
			end -- This Statement Went Through All Of A Characters Desendence Casting Shadows And Disables All Their Shadows
		end -- This Statement Got All Of The Decendents Of The Player
	end) -- This Function Disables A Players Shadow
	local leaderstats = Instance.new("Folder") -- Creates A Folder Named leaderstats 
	leaderstats.Name = "leaderstats" -- Names The Folder leaderstats
	leaderstats.Parent = Player	-- Puts The Folder Inside The Player
	local BowledBalls = Instance.new("IntValue") -- Creates A Value Named Bowled Balls
	BowledBalls.Parent = leaderstats -- Sets The Values Parent To leaderstats
	BowledBalls.Name = "Bowled" -- names the value "Bowled"
	local Score = Instance.new("IntValue") -- Creates A Value Named Score
	Score.Parent = leaderstats -- Sets The Values Parent To leaderstats
	Score.Name = "Score" -- Names The Value Score
	local data -- Sets A Variable Named data
	local success, errormessage = pcall(function() -- Tries To Get The Data From Roblox"s Servers
		data = BallsStore:GetAsync(Player.UserId.."-Bowled") -- Gets The Data And Sets It To The Data Value
	end) -- Ends The Function

	if success then -- Checks If It Worked
		BowledBalls.Value = data -- Sets The BowledBalls Value To The Data Value
		if data == nil then -- If The Player Has Never Played it fires this
			BowledBalls.Value = 0 -- Sets The Value To 0
		end -- This Made Sure the value was not nil
	end -- This Made Sure The Data Loaded Properly
	local success, errormessage = pcall(function() -- Tries To Get Data From Roblox"s Servers
		data = BallsStore:GetAsync(Player.UserId.."-Score") -- Gets The Data And Sets It To The Data Vale
	end) -- Ends The Function

	if success then -- Checks If it worked
		Score.Value = data -- Sets The Score Value To The Data Value
		if data == nil then -- If the player has never Played it fires this
			Score.Value = 0 -- Sets The Value to 0
		end -- This Made Sure The Score Value Is Not Nil
	end -- This Made Sure The Data Loaded Properly
end) -- This Has Disabled Players CastShadow, Created A Folder Named leaderstats, And Created 2 Values Named Bowled And Score, Then Loaded The Data Of Them
game.Players.PlayerRemoving:Connect(function(Plr) -- When The Player Leaves It Fires This
	local success, errormessage = pcall(function() -- Tries To Save The Data To Roblox's Servers
		BallsStore:SetAsync(Plr.UserId.."-Bowled", Plr.leaderstats.Bowled.Value) -- Saves The Bowled Value
	end) -- Ends The Function Saving The Bowled Value
	local success, errormessage = pcall(function() -- Tries To Save The Data To Roblox's Servers
		BallsStore:SetAsync(Plr.UserId.."-Score", Plr.leaderstats.Score.Value) -- Saved The Score Value
	end) -- Ends The Function Saving The Score Value
end) -- Saves The Data When The Player Leaves
local BadgeService = game:GetService("BadgeService") -- Gets The Badge Service -- Disclamer These Badges Dont Give Cuz I Havent Actualy Made The Badge If You Implement Your Own Badge Id It Will Work
local PlaceHolderBadge1 = 1 -- Lets A Player Set a 1st Placeholder Badge Id
local PlaceHolderBadge2 = 2 -- Lets A Player Set a 2nd Placeholder Badge Id
local PlaceHolderBadge3 = 3 -- Lets A Player Set a 3rd Placeholder Badge Id
local PlaceHolderBadge4 = 4 -- Lets A Player Set a 4th Placeholder Badge Id
local PlaceHolderBadge5 = 5 -- Lets A Player Set a 5th Placeholder Badge Id
game.ReplicatedStorage.BowlingActive.OnServerEvent:Connect(function(Player,power,Spin) -- Fires When The Fills Out The The Fourm
	local Spin = Spin * 2 -- Makes The Spin Value Bigger
	local Power = power * 2 -- Makes The Power Value Bigger
	if Player.leaderstats.Bowled.Value <= 5 then -- Checks If The Player Has A Amount Bowled To Give The Player A Ball1
		local Ball = game.ServerStorage.Ball1:Clone() -- Clones Ball1
		Ball.Parent = game.Workspace.ActiveBalls -- Sets The Cloned Balls parent To Active Balls(A Folder in workspace)
		Ball.Position = Player.Character.PrimaryPart.Position + Player.Character.PrimaryPart.CFrame.LookVector + Vector3.new(0,-3,0) -- Sets The Balls Position Slightly Infront Of The Player On The Ground
		Ball.Velocity = Player.Character.PrimaryPart.CFrame.LookVector * Power + Vector3.new(0,0,0) -- Sets The Balls Vellocity To What The Player Sets It To
		Ball.AssemblyAngularVelocity = Player.Character.PrimaryPart.CFrame.LookVector * Vector3.new(Spin,0,Spin) -- Puts Spin On The Ball
		local hasPass = false -- Makes A Value Named hasPass
		local passID = 804124589 -- Sets The PassId
		local Bowled = 1 -- Sets A Bowled Value
		local success, message = pcall(function() -- Makes Sure The Player Has The Gamepass
			hasPass = MarketplaceService:UserOwnsGamePassAsync(Player.UserId, passID) -- Actualy Checks
		end) -- This Actualy Checked If The Player Has The Gamepass And Sets Haspass To It
		if hasPass == true then -- Checks If The Player Has The Pass
		Bowled = Bowled * 2 -- Multiplys The Bowled Value
		end -- This Doubled The Player The Bowled Value If They Got The Pass
		if Player.MembershipType == Enum.MembershipType.Premium then -- Checks If The Player Has Premium
		Bowled = Bowled * 2 -- Multiplys The Bowled Value
		end -- Doubled The bowled If The Player Has Premium
		if Player:IsInGroup(33200215) then -- Checks If The Player Is In My Group
			Bowled = Bowled * 2 -- Multiplys The Bowled Value
		end -- If The Player Is In My Group It Multiplys
		Player.leaderstats.Bowled.Value = Player.leaderstats.Bowled.Value + Bowled -- Adds To The Bowled Value
		Ball.Touched:Connect(function(toutcher)  -- Finds What This New Ball Toutches
			if toutcher.Name == "Pin" then -- Checks If The Pin Is Touched Then It Plays This
				toutcher.CanTouch = false -- Disables The Pins Can Toutch
				local hasPass = false -- Makes A Value Named hasPass
				local passID = 803810936 -- Sets The PassId
				local Score = 10 -- Sets A Score Value
				local success, message = pcall(function() -- Makes Sure The Player Has The Gamepass
					hasPass = MarketplaceService:UserOwnsGamePassAsync(Player.UserId, passID) -- Actualy Checks
				end) -- This Actualy Checked If The Player Has The Gamepass And Sets Haspass To It
				local children = game.Players:GetChildren() -- Gets All The Players
				if hasPass == true then -- If The Player Has The Pass It Rewards The Player This
					Score = Score * 2 -- Multiplys The Score
				end -- Awards The Playe Score Pased On If They Had The pass Or Not
				if Player.MembershipType == Enum.MembershipType.Premium then -- Checks If The Player Has Premium
					Score = Score * 2 -- Multiplys The Score Value
				end -- Doubled The bowled If The Player Has Premium
				if Player:IsInGroup(33200215) then -- Checks If The Player Is In My Group
					Score = Score * 2 -- Multiplys The Score Value
				end -- If The Player Is In My Group It Multiplys
				for i = 1, #children do -- This Adds Score To All The Players
				children[i].leaderstats.Score.Value = children[i].leaderstats.Score.Value + Score -- Awards The Score
				end -- This Awarded The Player Score
				end -- This Has Awarded The Player Score
		end) -- This Has Awarded The Player Score
		if power > 100 then -- If The Power Is Above 100 It Will Enable The Fire And Smoke
			Ball.Fire.Enabled = true -- Enables Fire
			Ball.Sound.Value = "Explode" -- Sets A Value To Explosion -- Another Script Takes This Sound And Plays It
			task.wait(2) -- Waits 2 Seconds
			Ball.Smoke2.Enabled = true -- Enables Smoke
			task.wait(2) -- Waits 2 Seconds
			Ball:Destroy() -- Destroys Ball
		elseif power > 90 then -- Else If The Power Is Above 90 Runs The Following Code
			Ball.Black.Enabled = true -- Enables Black Effects
			Ball.Sound.Value = "SonicBoom" -- Plays Sonic boom -- Another Script Takes This Sound And Plays It
		elseif power > 80 then -- Else If The Power Is Above 80 It Runs The Following Code
			Ball.Fire.Enabled = true -- Enables Fire
			Ball.Sound.Value = "Fire" -- Plays Fire Sound -- Another Script Takes This Sound And Plays It
		elseif power > 70 then -- else Power Is Above 70 It Runs The Following Code
			Ball.Red.Enabled = true -- Plays Red Partical Effects
			Ball.Sound.Value = "Fire" -- Plays Fire Sound -- Another Script Takes This Sound And Plays It
		elseif power > 65 then -- Else If The Power Is Above 65 It Plays The Following Code
			Ball.Orange.Enabled = true -- Then Orange Effects Play
			Ball.Sound.Value = "Fire" -- Plays Fire -- Another Script Takes This Sound And Plays It
		elseif power > 60 then -- Else If The Power Is Above 60 It Runs The Following Code
			Ball.Yellow.Enabled = true -- Plays Yellow Partical Effects
			Ball.Sound.Value = "Fire" -- Plays Fire Sound -- Another Script Takes This Sound And Plays It
		elseif power > 55 then -- Else If The Power Is Above 55 Then It Runs The Following Code
			Ball.White.Enabled = true -- Plays White Partical Effects
			Ball.Sound.Value = "Fire" -- Plays Fire Sound -- Another Script Takes This Sound And Plays It
		elseif power > 50 then -- Else If The Power Is Above 50 It Runs The Following Code
			Ball.Pink.Enabled = true -- Pink Partical Effects Play
			Ball.Sound.Value = "Fire" -- Plays Fire Sound -- Another Script Takes This Sound And Plays It
		elseif power > 40 then -- Else If The Power Is Above 40 It Runs The Following Code
			Ball.Green.Enabled = true -- Enables Green Partical Effects
			Ball.Sound.Value = "Ice" -- Plays Ice Cracking Sound -- Another Script Takes This Sound And Plays It
		elseif power > 30 then -- Else If The Power Is Above 30 It Runs The Following Code
			Ball.White.Enabled = true -- Plays White Partical Effects
			Ball.Sound.Value = "Ice" -- Plays Ice Cracking Partical Effects -- Another Script Takes This Sound And Plays It
		elseif power > 20 then -- Else If The Power Is Above 20 It Runs The Following Code
			Ball.Purple.Enabled = true -- Purple Partical Effects Play
			Ball.Sound.Value = "Ice" -- Plays Ice Cracking Sound -- Another Script Takes This Sound And Plays It
		elseif power > 15 then -- Else If The Power Is Above 15 It Runs The Following Code
			Ball.DeepBlue.Enabled = true -- Deep Blue Partical Effects Play
			Ball.Sound.Value = "Ice" -- Plays Ice Cracking Sound -- Another Script Takes This Sound And Plays It
		elseif power > 10 then -- Else If The Power Is Above 10 It Runs The Following Code
			Ball.Blue.Enabled = true -- Plays Blue Partical Effects
			Ball.Sound.Value = "Ice" -- Ice Cracking Effects Play
		elseif power > 0 then -- If The Power Is Above Runs The Following Code
			Ball.Cyan.Enabled = true -- Enables Cyan Partical Effects
			Ball.Sound.Value = "Ice" -- Ice Cracking Sound Plays -- Another Script Takes This Sound And Plays It
		end -- This Has Bowled A Ball And Played Partical Effects
	elseif Player.leaderstats.Bowled.Value <= 10 then -- If The Player Has Bowled Less Than 10 Balls And More Than 5 Balls It Runs The Following Code
		local Ball = game.ServerStorage.Ball2:Clone() -- Clones Ball 2
		Ball.Parent = game.Workspace.ActiveBalls -- Sets The Cloned Balls parent To Active Balls(A Folder in workspace)
		Ball.Position = Player.Character.PrimaryPart.Position + Player.Character.PrimaryPart.CFrame.LookVector + Vector3.new(0,-3,0) -- Sets The Balls Position Slightly Infront Of The Player On The Ground
		Ball.Velocity = Player.Character.PrimaryPart.CFrame.LookVector * Power + Vector3.new(0,0,0) -- Sets The Balls Vellocity To What The Player Sets It To
		Ball.AssemblyAngularVelocity = Player.Character.PrimaryPart.CFrame.LookVector * Vector3.new(Spin,0,Spin) -- Puts Spin On The Ball
		local hasPass = false -- Makes A Value Named hasPass
		local passID = 804124589 -- Sets The PassId
		local Bowled = 1 -- Sets A Bowled Value
		local success, message = pcall(function() -- Makes Sure The Player Has The Gamepass
			hasPass = MarketplaceService:UserOwnsGamePassAsync(Player.UserId, passID) -- Actualy Checks
		end) -- This Actualy Checked If The Player Has The Gamepass And Sets Haspass To It
		if hasPass == true then -- Checks If The Player Has The Pass
			Bowled = Bowled * 2 -- Multiplys The Bowled Value
		end -- This Doubled The Player The Bowled Value If They Got The Pass
		if Player.MembershipType == Enum.MembershipType.Premium then -- Checks If The Player Has Premium
			Bowled = Bowled * 2 -- Multiplys The Bowled Value
		end -- Doubled The bowled If The Player Has Premium
		if Player:IsInGroup(33200215) then -- Checks If The Player Is In My Group
			Bowled = Bowled * 2 -- Multiplys The Bowled Value
		end -- If The Player Is In My Group It Multiplys
		Player.leaderstats.Bowled.Value = Player.leaderstats.Bowled.Value + Bowled -- Adds To The Bowled Value
		Ball.Touched:Connect(function(toutcher)  -- Finds What This New Ball Toutches
			if toutcher.Name == "Pin" then -- Checks If The Pin Is Touched Then It Plays This
				toutcher.CanTouch = false -- Disables The Pins Can Toutch
				local hasPass = false -- Makes A Value Named hasPass
				local passID = 803810936 -- Sets The PassId
				local Score = 20 -- Sets A Score Value
				local success, message = pcall(function() -- Makes Sure The Player Has The Gamepass
					hasPass = MarketplaceService:UserOwnsGamePassAsync(Player.UserId, passID) -- Actualy Checks
				end) -- This Actualy Checked If The Player Has The Gamepass And Sets Haspass To It
				local children = game.Players:GetChildren() -- Gets All The Players
				if hasPass == true then -- If The Player Has The Pass It Rewards The Player This
					Score = Score * 2 -- Multiplys The Score
				end -- Awards The Playe Score Pased On If They Had The pass Or Not
				if Player.MembershipType == Enum.MembershipType.Premium then -- Checks If The Player Has Premium
					Score = Score * 2 -- Multiplys The Score Value
				end -- Doubled The bowled If The Player Has Premium
				if Player:IsInGroup(33200215) then -- Checks If The Player Is In My Group
					Score = Score * 2 -- Multiplys The Score Value
				end -- If The Player Is In My Group It Multiplys
				for i = 1, #children do -- This Adds Score To All The Players
					children[i].leaderstats.Score.Value = children[i].leaderstats.Score.Value + Score -- Awards The Score
				end -- This Awarded The Player Score
			end -- This Has Awarded The Player Score
		end) -- This Has Awarded The Player Score
		if power > 100 then -- If The Power Is Above 100 It Will Enable The Fire And Smoke
			Ball.Fire.Enabled = true -- Enables Fire
			Ball.Sound.Value = "Explode" -- Sets A Value To Explosion -- Another Script Takes This Sound And Plays It
			task.wait(2) -- Waits 2 Seconds
			Ball.Smoke2.Enabled = true -- Enables Smoke
			task.wait(2) -- Waits 2 Seconds
			Ball:Destroy() -- Destroys Ball
		elseif power > 90 then -- Else If The Power Is Above 90 Runs The Following Code
			Ball.Black.Enabled = true -- Enables Black Effects
			Ball.Sound.Value = "SonicBoom" -- Plays Sonic boom -- Another Script Takes This Sound And Plays It
		elseif power > 80 then -- Else If The Power Is Above 80 It Runs The Following Code
			Ball.Fire.Enabled = true -- Enables Fire
			Ball.Sound.Value = "Fire" -- Plays Fire Sound -- Another Script Takes This Sound And Plays It
		elseif power > 70 then -- else Power Is Above 70 It Runs The Following Code
			Ball.Red.Enabled = true -- Plays Red Partical Effects
			Ball.Sound.Value = "Fire" -- Plays Fire Sound -- Another Script Takes This Sound And Plays It
		elseif power > 65 then -- Else If The Power Is Above 65 It Plays The Following Code
			Ball.Orange.Enabled = true -- Then Orange Effects Play
			Ball.Sound.Value = "Fire" -- Plays Fire -- Another Script Takes This Sound And Plays It
		elseif power > 60 then -- Else If The Power Is Above 60 It Runs The Following Code
			Ball.Yellow.Enabled = true -- Plays Yellow Partical Effects
			Ball.Sound.Value = "Fire" -- Plays Fire Sound -- Another Script Takes This Sound And Plays It
		elseif power > 55 then -- Else If The Power Is Above 55 Then It Runs The Following Code
			Ball.White.Enabled = true -- Plays White Partical Effects
			Ball.Sound.Value = "Fire" -- Plays Fire Sound -- Another Script Takes This Sound And Plays It
		elseif power > 50 then -- Else If The Power Is Above 50 It Runs The Following Code
			Ball.Pink.Enabled = true -- Pink Partical Effects Play
			Ball.Sound.Value = "Fire" -- Plays Fire Sound -- Another Script Takes This Sound And Plays It
		elseif power > 40 then -- Else If The Power Is Above 40 It Runs The Following Code
			Ball.Green.Enabled = true -- Enables Green Partical Effects
			Ball.Sound.Value = "Ice" -- Plays Ice Cracking Sound -- Another Script Takes This Sound And Plays It
		elseif power > 30 then -- Else If The Power Is Above 30 It Runs The Following Code
			Ball.White.Enabled = true -- Plays White Partical Effects
			Ball.Sound.Value = "Ice" -- Plays Ice Cracking Partical Effects -- Another Script Takes This Sound And Plays It
		elseif power > 20 then -- Else If The Power Is Above 20 It Runs The Following Code
			Ball.Purple.Enabled = true -- Purple Partical Effects Play
			Ball.Sound.Value = "Ice" -- Plays Ice Cracking Sound -- Another Script Takes This Sound And Plays It
		elseif power > 15 then -- Else If The Power Is Above 15 It Runs The Following Code
			Ball.DeepBlue.Enabled = true -- Deep Blue Partical Effects Play
			Ball.Sound.Value = "Ice" -- Plays Ice Cracking Sound -- Another Script Takes This Sound And Plays It
		elseif power > 10 then -- Else If The Power Is Above 10 It Runs The Following Code
			Ball.Blue.Enabled = true -- Plays Blue Partical Effects
			Ball.Sound.Value = "Ice" -- Ice Cracking Effects Play
		elseif power > 0 then -- If The Power Is Above Runs The Following Code
			Ball.Cyan.Enabled = true -- Enables Cyan Partical Effects
			Ball.Sound.Value = "Ice" -- Ice Cracking Sound Plays -- Another Script Takes This Sound And Plays It
		end -- This Has Bowled A Ball And Played Partical Effects
	elseif Player.leaderstats.Bowled.Value <= 25 then -- If The Player Has Less Than 25 Bowled And More Than 10 Bowled It Runs The Following Code
		local Ball = game.ServerStorage.Ball3:Clone() -- Clones Ball3
		Ball.Parent = game.Workspace.ActiveBalls -- Sets The Cloned Balls parent To Active Balls(A Folder in workspace)
		Ball.Position = Player.Character.PrimaryPart.Position + Player.Character.PrimaryPart.CFrame.LookVector + Vector3.new(0,-3,0) -- Sets The Balls Position Slightly Infront Of The Player On The Ground
		Ball.Velocity = Player.Character.PrimaryPart.CFrame.LookVector * Power + Vector3.new(0,0,0) -- Sets The Balls Vellocity To What The Player Sets It To
		Ball.AssemblyAngularVelocity = Player.Character.PrimaryPart.CFrame.LookVector * Vector3.new(Spin,0,Spin) -- Puts Spin On The Ball
		local hasPass = false -- Makes A Value Named hasPass
		local passID = 804124589 -- Sets The PassId
		local Bowled = 1 -- Sets A Bowled Value
		local success, message = pcall(function() -- Makes Sure The Player Has The Gamepass
			hasPass = MarketplaceService:UserOwnsGamePassAsync(Player.UserId, passID) -- Actualy Checks
		end) -- This Actualy Checked If The Player Has The Gamepass And Sets Haspass To It
		if hasPass == true then -- Checks If The Player Has The Pass
			Bowled = Bowled * 2 -- Multiplys The Bowled Value
		end -- This Doubled The Player The Bowled Value If They Got The Pass
		if Player.MembershipType == Enum.MembershipType.Premium then -- Checks If The Player Has Premium
			Bowled = Bowled * 2 -- Multiplys The Bowled Value
		end -- Doubled The bowled If The Player Has Premium
		if Player:IsInGroup(33200215) then -- Checks If The Player Is In My Group
			Bowled = Bowled * 2 -- Multiplys The Bowled Value
		end -- If The Player Is In My Group It Multiplys
		Player.leaderstats.Bowled.Value = Player.leaderstats.Bowled.Value + Bowled -- Adds To The Bowled Value
		Ball.Touched:Connect(function(toutcher)  -- Finds What This New Ball Toutches
			if toutcher.Name == "Pin" then -- Checks If The Pin Is Touched Then It Plays This
				toutcher.CanTouch = false -- Disables The Pins Can Toutch
				local hasPass = false -- Makes A Value Named hasPass
				local passID = 803810936 -- Sets The PassId
				local Score = 40 -- Sets A Score Value
				local success, message = pcall(function() -- Makes Sure The Player Has The Gamepass
					hasPass = MarketplaceService:UserOwnsGamePassAsync(Player.UserId, passID) -- Actualy Checks
				end) -- This Actualy Checked If The Player Has The Gamepass And Sets Haspass To It
				local children = game.Players:GetChildren() -- Gets All The Players
				if hasPass == true then -- If The Player Has The Pass It Rewards The Player This
					Score = Score * 2 -- Multiplys The Score
				end -- Awards The Playe Score Pased On If They Had The pass Or Not
				if Player.MembershipType == Enum.MembershipType.Premium then -- Checks If The Player Has Premium
					Score = Score * 2 -- Multiplys The Score Value
				end -- Doubled The bowled If The Player Has Premium
				if Player:IsInGroup(33200215) then -- Checks If The Player Is In My Group
					Score = Score * 2 -- Multiplys The Score Value
				end -- If The Player Is In My Group It Multiplys
				for i = 1, #children do -- This Adds Score To All The Players
					children[i].leaderstats.Score.Value = children[i].leaderstats.Score.Value + Score -- Awards The Score
				end -- This Awarded The Player Score
			end -- This Has Awarded The Player Score
		end) -- This Has Awarded The Player Score
		if power > 100 then -- If The Power Is Above 100 It Will Enable The Fire And Smoke
			Ball.Fire.Enabled = true -- Enables Fire
			Ball.Sound.Value = "Explode" -- Sets A Value To Explosion -- Another Script Takes This Sound And Plays It
			task.wait(2) -- Waits 2 Seconds
			Ball.Smoke2.Enabled = true -- Enables Smoke
			task.wait(2) -- Waits 2 Seconds
			Ball:Destroy() -- Destroys Ball
		elseif power > 90 then -- Else If The Power Is Above 90 Runs The Following Code
			Ball.Black.Enabled = true -- Enables Black Effects
			Ball.Sound.Value = "SonicBoom" -- Plays Sonic boom -- Another Script Takes This Sound And Plays It
		elseif power > 80 then -- Else If The Power Is Above 80 It Runs The Following Code
			Ball.Fire.Enabled = true -- Enables Fire
			Ball.Sound.Value = "Fire" -- Plays Fire Sound -- Another Script Takes This Sound And Plays It
		elseif power > 70 then -- else Power Is Above 70 It Runs The Following Code
			Ball.Red.Enabled = true -- Plays Red Partical Effects
			Ball.Sound.Value = "Fire" -- Plays Fire Sound -- Another Script Takes This Sound And Plays It
		elseif power > 65 then -- Else If The Power Is Above 65 It Plays The Following Code
			Ball.Orange.Enabled = true -- Then Orange Effects Play
			Ball.Sound.Value = "Fire" -- Plays Fire -- Another Script Takes This Sound And Plays It
		elseif power > 60 then -- Else If The Power Is Above 60 It Runs The Following Code
			Ball.Yellow.Enabled = true -- Plays Yellow Partical Effects
			Ball.Sound.Value = "Fire" -- Plays Fire Sound -- Another Script Takes This Sound And Plays It
		elseif power > 55 then -- Else If The Power Is Above 55 Then It Runs The Following Code
			Ball.White.Enabled = true -- Plays White Partical Effects
			Ball.Sound.Value = "Fire" -- Plays Fire Sound -- Another Script Takes This Sound And Plays It
		elseif power > 50 then -- Else If The Power Is Above 50 It Runs The Following Code
			Ball.Pink.Enabled = true -- Pink Partical Effects Play
			Ball.Sound.Value = "Fire" -- Plays Fire Sound -- Another Script Takes This Sound And Plays It
		elseif power > 40 then -- Else If The Power Is Above 40 It Runs The Following Code
			Ball.Green.Enabled = true -- Enables Green Partical Effects
			Ball.Sound.Value = "Ice" -- Plays Ice Cracking Sound -- Another Script Takes This Sound And Plays It
		elseif power > 30 then -- Else If The Power Is Above 30 It Runs The Following Code
			Ball.White.Enabled = true -- Plays White Partical Effects
			Ball.Sound.Value = "Ice" -- Plays Ice Cracking Partical Effects -- Another Script Takes This Sound And Plays It
		elseif power > 20 then -- Else If The Power Is Above 20 It Runs The Following Code
			Ball.Purple.Enabled = true -- Purple Partical Effects Play
			Ball.Sound.Value = "Ice" -- Plays Ice Cracking Sound -- Another Script Takes This Sound And Plays It
		elseif power > 15 then -- Else If The Power Is Above 15 It Runs The Following Code
			Ball.DeepBlue.Enabled = true -- Deep Blue Partical Effects Play
			Ball.Sound.Value = "Ice" -- Plays Ice Cracking Sound -- Another Script Takes This Sound And Plays It
		elseif power > 10 then -- Else If The Power Is Above 10 It Runs The Following Code
			Ball.Blue.Enabled = true -- Plays Blue Partical Effects
			Ball.Sound.Value = "Ice" -- Ice Cracking Effects Play
		elseif power > 0 then -- If The Power Is Above Runs The Following Code
			Ball.Cyan.Enabled = true -- Enables Cyan Partical Effects
			Ball.Sound.Value = "Ice" -- Ice Cracking Sound Plays -- Another Script Takes This Sound And Plays It
		end -- This Has Bowled A Ball And Played Partical Effects
	elseif Player.leaderstats.Bowled.Value >= 50 then -- If The Players Bowled Balls Are Above 50 Than It runs The Following Code
		local Ball = game.ServerStorage.Ball4:Clone() -- Clones Ball4
		Ball.Parent = game.Workspace.ActiveBalls -- Sets The Cloned Balls parent To Active Balls(A Folder in workspace)
		Ball.Position = Player.Character.PrimaryPart.Position + Player.Character.PrimaryPart.CFrame.LookVector + Vector3.new(0,-3,0) -- Sets The Balls Position Slightly Infront Of The Player On The Ground
		Ball.Velocity = Player.Character.PrimaryPart.CFrame.LookVector * Power + Vector3.new(0,0,0) -- Sets The Balls Vellocity To What The Player Sets It To
		Ball.AssemblyAngularVelocity = Player.Character.PrimaryPart.CFrame.LookVector * Vector3.new(Spin,0,Spin) -- Puts Spin On The Ball
		local hasPass = false -- Makes A Value Named hasPass
		local passID = 804124589 -- Sets The PassId
		local Bowled = 1 -- Sets A Bowled Value
		local success, message = pcall(function() -- Makes Sure The Player Has The Gamepass
			hasPass = MarketplaceService:UserOwnsGamePassAsync(Player.UserId, passID) -- Actualy Checks
		end) -- This Actualy Checked If The Player Has The Gamepass And Sets Haspass To It
		if hasPass == true then -- Checks If The Player Has The Pass
			Bowled = Bowled * 2 -- Multiplys The Bowled Value
		end -- This Doubled The Player The Bowled Value If They Got The Pass
		if Player.MembershipType == Enum.MembershipType.Premium then -- Checks If The Player Has Premium
			Bowled = Bowled * 2 -- Multiplys The Bowled Value
		end -- Doubled The bowled If The Player Has Premium
		if Player:IsInGroup(33200215) then -- Checks If The Player Is In My Group
			Bowled = Bowled * 2 -- Multiplys The Bowled Value
		end -- If The Player Is In My Group It Multiplys
		Player.leaderstats.Bowled.Value = Player.leaderstats.Bowled.Value + Bowled -- Adds To The Bowled Value
		Ball.Touched:Connect(function(toutcher)  -- Finds What This New Ball Toutches
			if toutcher.Name == "Pin" then -- Checks If The Pin Is Touched Then It Plays This
				toutcher.CanTouch = false -- Disables The Pins Can Toutch
				local hasPass = false -- Makes A Value Named hasPass
				local passID = 803810936 -- Sets The PassId
				local Score = 80 -- Sets A Score Value
				local success, message = pcall(function() -- Makes Sure The Player Has The Gamepass
					hasPass = MarketplaceService:UserOwnsGamePassAsync(Player.UserId, passID) -- Actualy Checks
				end) -- This Actualy Checked If The Player Has The Gamepass And Sets Haspass To It
				local children = game.Players:GetChildren() -- Gets All The Players
				if hasPass == true then -- If The Player Has The Pass It Rewards The Player This
					Score = Score * 2 -- Multiplys The Score
				end -- Awards The Playe Score Pased On If They Had The pass Or Not
				if Player.MembershipType == Enum.MembershipType.Premium then -- Checks If The Player Has Premium
					Score = Score * 2 -- Multiplys The Score Value
				end -- Doubled The bowled If The Player Has Premium
				if Player:IsInGroup(33200215) then -- Checks If The Player Is In My Group
					Score = Score * 2 -- Multiplys The Score Value
				end -- If The Player Is In My Group It Multiplys
				for i = 1, #children do -- This Adds Score To All The Players
					children[i].leaderstats.Score.Value = children[i].leaderstats.Score.Value + Score -- Awards The Score
				end -- This Awarded The Player Score
			end -- This Has Awarded The Player Score
		end) -- This Has Awarded The Player Score
		if power > 100 then -- If The Power Is Above 100 It Will Enable The Fire And Smoke
			Ball.Fire.Enabled = true -- Enables Fire
			Ball.Sound.Value = "Explode" -- Sets A Value To Explosion -- Another Script Takes This Sound And Plays It
			task.wait(2) -- Waits 2 Seconds
			Ball.Smoke2.Enabled = true -- Enables Smoke
			task.wait(2) -- Waits 2 Seconds
			Ball:Destroy() -- Destroys Ball
		elseif power > 90 then -- Else If The Power Is Above 90 Runs The Following Code
			Ball.Black.Enabled = true -- Enables Black Effects
			Ball.Sound.Value = "SonicBoom" -- Plays Sonic boom -- Another Script Takes This Sound And Plays It
		elseif power > 80 then -- Else If The Power Is Above 80 It Runs The Following Code
			Ball.Fire.Enabled = true -- Enables Fire
			Ball.Sound.Value = "Fire" -- Plays Fire Sound -- Another Script Takes This Sound And Plays It
		elseif power > 70 then -- else Power Is Above 70 It Runs The Following Code
			Ball.Red.Enabled = true -- Plays Red Partical Effects
			Ball.Sound.Value = "Fire" -- Plays Fire Sound -- Another Script Takes This Sound And Plays It
		elseif power > 65 then -- Else If The Power Is Above 65 It Plays The Following Code
			Ball.Orange.Enabled = true -- Then Orange Effects Play
			Ball.Sound.Value = "Fire" -- Plays Fire -- Another Script Takes This Sound And Plays It
		elseif power > 60 then -- Else If The Power Is Above 60 It Runs The Following Code
			Ball.Yellow.Enabled = true -- Plays Yellow Partical Effects
			Ball.Sound.Value = "Fire" -- Plays Fire Sound -- Another Script Takes This Sound And Plays It
		elseif power > 55 then -- Else If The Power Is Above 55 Then It Runs The Following Code
			Ball.White.Enabled = true -- Plays White Partical Effects
			Ball.Sound.Value = "Fire" -- Plays Fire Sound -- Another Script Takes This Sound And Plays It
		elseif power > 50 then -- Else If The Power Is Above 50 It Runs The Following Code
			Ball.Pink.Enabled = true -- Pink Partical Effects Play
			Ball.Sound.Value = "Fire" -- Plays Fire Sound -- Another Script Takes This Sound And Plays It
		elseif power > 40 then -- Else If The Power Is Above 40 It Runs The Following Code
			Ball.Green.Enabled = true -- Enables Green Partical Effects
			Ball.Sound.Value = "Ice" -- Plays Ice Cracking Sound -- Another Script Takes This Sound And Plays It
		elseif power > 30 then -- Else If The Power Is Above 30 It Runs The Following Code
			Ball.White.Enabled = true -- Plays White Partical Effects
			Ball.Sound.Value = "Ice" -- Plays Ice Cracking Partical Effects -- Another Script Takes This Sound And Plays It
		elseif power > 20 then -- Else If The Power Is Above 20 It Runs The Following Code
			Ball.Purple.Enabled = true -- Purple Partical Effects Play
			Ball.Sound.Value = "Ice" -- Plays Ice Cracking Sound -- Another Script Takes This Sound And Plays It
		elseif power > 15 then -- Else If The Power Is Above 15 It Runs The Following Code
			Ball.DeepBlue.Enabled = true -- Deep Blue Partical Effects Play
			Ball.Sound.Value = "Ice" -- Plays Ice Cracking Sound -- Another Script Takes This Sound And Plays It
		elseif power > 10 then -- Else If The Power Is Above 10 It Runs The Following Code
			Ball.Blue.Enabled = true -- Plays Blue Partical Effects
			Ball.Sound.Value = "Ice" -- Ice Cracking Effects Play
		elseif power > 0 then -- If The Power Is Above Runs The Following Code
			Ball.Cyan.Enabled = true -- Enables Cyan Partical Effects
			Ball.Sound.Value = "Ice" -- Ice Cracking Sound Plays -- Another Script Takes This Sound And Plays It
		end -- This Has Bowled A Ball And Played Partical Effects
	elseif Player.leaderstats.Bowled.Value <= 100 then -- If The Player Has Less Than 100 Balls Bowled And More Than 50 Balls Bowled it runs The Following Code
		local Ball = game.ServerStorage.Ball5:Clone() -- Clones Ball5
		Ball.Parent = game.Workspace.ActiveBalls -- Sets The Cloned Balls parent To Active Balls(A Folder in workspace)
		Ball.Position = Player.Character.PrimaryPart.Position + Player.Character.PrimaryPart.CFrame.LookVector + Vector3.new(0,-3,0) -- Sets The Balls Position Slightly Infront Of The Player On The Ground
		Ball.Velocity = Player.Character.PrimaryPart.CFrame.LookVector * Power + Vector3.new(0,0,0) -- Sets The Balls Vellocity To What The Player Sets It To
		Ball.AssemblyAngularVelocity = Player.Character.PrimaryPart.CFrame.LookVector * Vector3.new(Spin,0,Spin) -- Puts Spin On The Ball
		local hasPass = false -- Makes A Value Named hasPass
		local passID = 804124589 -- Sets The PassId
		local Bowled = 1 -- Sets A Bowled Value
		local success, message = pcall(function() -- Makes Sure The Player Has The Gamepass
			hasPass = MarketplaceService:UserOwnsGamePassAsync(Player.UserId, passID) -- Actualy Checks
		end) -- This Actualy Checked If The Player Has The Gamepass And Sets Haspass To It
		if hasPass == true then -- Checks If The Player Has The Pass
			Bowled = Bowled * 2 -- Multiplys The Bowled Value
		end -- This Doubled The Player The Bowled Value If They Got The Pass
		if Player.MembershipType == Enum.MembershipType.Premium then -- Checks If The Player Has Premium
			Bowled = Bowled * 2 -- Multiplys The Bowled Value
		end -- Doubled The bowled If The Player Has Premium
		if Player:IsInGroup(33200215) then -- Checks If The Player Is In My Group
			Bowled = Bowled * 2 -- Multiplys The Bowled Value
		end -- If The Player Is In My Group It Multiplys
		Player.leaderstats.Bowled.Value = Player.leaderstats.Bowled.Value + Bowled -- Adds To The Bowled Value
		Ball.Touched:Connect(function(toutcher)  -- Finds What This New Ball Toutches
			if toutcher.Name == "Pin" then -- Checks If The Pin Is Touched Then It Plays This
				toutcher.CanTouch = false -- Disables The Pins Can Toutch
				local hasPass = false -- Makes A Value Named hasPass
				local passID = 803810936 -- Sets The PassId
				local Score = 160 -- Sets A Score Value
				local success, message = pcall(function() -- Makes Sure The Player Has The Gamepass
					hasPass = MarketplaceService:UserOwnsGamePassAsync(Player.UserId, passID) -- Actualy Checks
				end) -- This Actualy Checked If The Player Has The Gamepass And Sets Haspass To It
				local children = game.Players:GetChildren() -- Gets All The Players
				if hasPass == true then -- If The Player Has The Pass It Rewards The Player This
					Score = Score * 2 -- Multiplys The Score
				end -- Awards The Playe Score Pased On If They Had The pass Or Not
				if Player.MembershipType == Enum.MembershipType.Premium then -- Checks If The Player Has Premium
					Score = Score * 2 -- Multiplys The Score Value
				end -- Doubled The bowled If The Player Has Premium
				if Player:IsInGroup(33200215) then -- Checks If The Player Is In My Group
					Score = Score * 2 -- Multiplys The Score Value
				end -- If The Player Is In My Group It Multiplys
				for i = 1, #children do -- This Adds Score To All The Players
					children[i].leaderstats.Score.Value = children[i].leaderstats.Score.Value + Score -- Awards The Score
				end -- This Awarded The Player Score
			end -- This Has Awarded The Player Score
		end) -- This Has Awarded The Player Score
		if power > 100 then -- If The Power Is Above 100 It Will Enable The Fire And Smoke
			Ball.Fire.Enabled = true -- Enables Fire
			Ball.Sound.Value = "Explode" -- Sets A Value To Explosion -- Another Script Takes This Sound And Plays It
			task.wait(2) -- Waits 2 Seconds
			Ball.Smoke2.Enabled = true -- Enables Smoke
			task.wait(2) -- Waits 2 Seconds
			Ball:Destroy() -- Destroys Ball
		elseif power > 90 then -- Else If The Power Is Above 90 Runs The Following Code
			Ball.Black.Enabled = true -- Enables Black Effects
			Ball.Sound.Value = "SonicBoom" -- Plays Sonic boom -- Another Script Takes This Sound And Plays It
		elseif power > 80 then -- Else If The Power Is Above 80 It Runs The Following Code
			Ball.Fire.Enabled = true -- Enables Fire
			Ball.Sound.Value = "Fire" -- Plays Fire Sound -- Another Script Takes This Sound And Plays It
		elseif power > 70 then -- else Power Is Above 70 It Runs The Following Code
			Ball.Red.Enabled = true -- Plays Red Partical Effects
			Ball.Sound.Value = "Fire" -- Plays Fire Sound -- Another Script Takes This Sound And Plays It
		elseif power > 65 then -- Else If The Power Is Above 65 It Plays The Following Code
			Ball.Orange.Enabled = true -- Then Orange Effects Play
			Ball.Sound.Value = "Fire" -- Plays Fire -- Another Script Takes This Sound And Plays It
		elseif power > 60 then -- Else If The Power Is Above 60 It Runs The Following Code
			Ball.Yellow.Enabled = true -- Plays Yellow Partical Effects
			Ball.Sound.Value = "Fire" -- Plays Fire Sound -- Another Script Takes This Sound And Plays It
		elseif power > 55 then -- Else If The Power Is Above 55 Then It Runs The Following Code
			Ball.White.Enabled = true -- Plays White Partical Effects
			Ball.Sound.Value = "Fire" -- Plays Fire Sound -- Another Script Takes This Sound And Plays It
		elseif power > 50 then -- Else If The Power Is Above 50 It Runs The Following Code
			Ball.Pink.Enabled = true -- Pink Partical Effects Play
			Ball.Sound.Value = "Fire" -- Plays Fire Sound -- Another Script Takes This Sound And Plays It
		elseif power > 40 then -- Else If The Power Is Above 40 It Runs The Following Code
			Ball.Green.Enabled = true -- Enables Green Partical Effects
			Ball.Sound.Value = "Ice" -- Plays Ice Cracking Sound -- Another Script Takes This Sound And Plays It
		elseif power > 30 then -- Else If The Power Is Above 30 It Runs The Following Code
			Ball.White.Enabled = true -- Plays White Partical Effects
			Ball.Sound.Value = "Ice" -- Plays Ice Cracking Partical Effects -- Another Script Takes This Sound And Plays It
		elseif power > 20 then -- Else If The Power Is Above 20 It Runs The Following Code
			Ball.Purple.Enabled = true -- Purple Partical Effects Play
			Ball.Sound.Value = "Ice" -- Plays Ice Cracking Sound -- Another Script Takes This Sound And Plays It
		elseif power > 15 then -- Else If The Power Is Above 15 It Runs The Following Code
			Ball.DeepBlue.Enabled = true -- Deep Blue Partical Effects Play
			Ball.Sound.Value = "Ice" -- Plays Ice Cracking Sound -- Another Script Takes This Sound And Plays It
		elseif power > 10 then -- Else If The Power Is Above 10 It Runs The Following Code
			Ball.Blue.Enabled = true -- Plays Blue Partical Effects
			Ball.Sound.Value = "Ice" -- Ice Cracking Effects Play
		elseif power > 0 then -- If The Power Is Above Runs The Following Code
			Ball.Cyan.Enabled = true -- Enables Cyan Partical Effects
			Ball.Sound.Value = "Ice" -- Ice Cracking Sound Plays -- Another Script Takes This Sound And Plays It
		end -- This Has Bowled A Ball And Played Partical Effects
	end -- This Has Bowled A Ball And Played Partical Effects For Every Level Of Ball
	if Player.leaderstats.Bowled.Value == 5 then -- Checks If The Player Has Bowled 5 Balls
		local OwnedBadge = BadgeService:UserHasBadgeAsync(Player.UserId, PlaceHolderBadge1) -- Checks If The Player Owns The Badge
		if not OwnedBadge then -- If They Dont Own Badge it plays this
			BadgeService:AwardBadge(Player.UserId, PlaceHolderBadge1) -- Awards Badge
		end -- This Awarded A Player The Badge
		elseif Player.leaderstats.Bowled.Value == 10 then -- Checks If The Player Has Bowled 10 Balls
		local OwnedBadge = BadgeService:UserHasBadgeAsync(Player.UserId, PlaceHolderBadge2) -- Checks If The Player Owns The Badge
		if not OwnedBadge then -- If They Dont Own Badge it plays this
				BadgeService:AwardBadge(Player.UserId, PlaceHolderBadge2) -- Awards Badge
		end -- This Awarded A Player The Badge
		elseif Player.leaderstats.Bowled.Value == 25 then -- Checks If The Player Has Bowled 25 Balls
		local OwnedBadge = BadgeService:UserHasBadgeAsync(Player.UserId, PlaceHolderBadge3) -- Checks If The Player Owns The Badge
		if not OwnedBadge then -- If They Dont Own Badge it plays this
			BadgeService:AwardBadge(Player.UserId, PlaceHolderBadge3) -- Awards Badge
		end -- This Awarded A Player The Badge
		elseif Player.leaderstats.Bowled.Value == 50 then -- Checks If The Player Has Bowled 50 Balls
			local OwnedBadge = BadgeService:UserHasBadgeAsync(Player.UserId, PlaceHolderBadge4) -- Checks If The Player Owns The Badge
			if not OwnedBadge then -- If They Dont Own Badge it plays this
				BadgeService:AwardBadge(Player.UserId, PlaceHolderBadge4) -- Awards Badge
		end -- This Awarded A Player The Badge
		elseif Player.leaderstats.Bowled.Value == 100 then -- Checks If The Player Has Bowled 100 Balls
		local OwnedBadge = BadgeService:UserHasBadgeAsync(Player.UserId, PlaceHolderBadge5) -- Checks If The Player Owns The Badge
		if not OwnedBadge then -- If They Dont Own Badge it plays this
				BadgeService:AwardBadge(Player.UserId, PlaceHolderBadge5) -- Awards Badge
		end -- This Awarded A Player The Badge
		end -- This Has Awarded All Of The Players The Badges
	end) -- Ends The Function That Bowled All Of The Balls And Gave Them The Badges
game.ReplicatedStorage.Reset.OnServerEvent:Connect(function() -- When The Player Presses Q It Plays This -- Comes From Another Local Script
	workspace.Alley:Destroy() -- Destroys Alley In Workspace
	local Alley = game.ServerStorage.Alley:Clone() -- Clones An Alley From Server Storage
	Alley.Parent = workspace -- Sets The Alley's Parent To Workspace
end) -- This Has Reset The Alley
-- Feel Free To Use This Script Although It Might Be Hard To Implement It Because There Are Alot Of Outside Things, Thanks For Reading This And Sorry For Misspelled Words, Grammer, And Capitalization Im Dislexic :P (Dislexia Is A Mental "Deficency" That Makes It Hard For Me To Do Launguage Oriented Things)

This is a script from the State Of Nature Demo that I havent noted!

local Char = script.Parent.Torso
local PFS = game:GetService("PathfindingService")
local Human = script.Parent:WaitForChild("Humanoid")
local Path = PFS:CreatePath()
local FoundEnimie = false
local MaxDistance = 100
repeat
	task.wait(0.1)
	local AllParts = workspace.Food:GetChildren()
	for i, IndividualPart in pairs(AllParts) do
		local ClosestDistance = 2000
		local ClosestPart = 2000
		for i, IndividualPart in pairs(AllParts) do
			local Distance = (Char.Position - IndividualPart.Position).magnitude
			if Distance < ClosestDistance then
				ClosestDistance = Distance
				ClosestPart = IndividualPart
			end
		end
		for i, IndividualPart in pairs(workspace.Humans:GetChildren()) do
			if script.Parent.NumOfHuman.Value ~= IndividualPart.NumOfHuman.Value then
				local Distance = (Char.Position - IndividualPart.Torso.Position).magnitude
				if MaxDistance > Distance then
					ClosestPart = IndividualPart
					FoundEnimie = true
				end
			end
		end
		if FoundEnimie == true then
			local Success, Error = pcall(function() -- wraps a pcall
				Path:ComputeAsync(Char.Position, ClosestPart.Torso.Position)
				Human:MoveTo(ClosestPart.Torso.Position)
			end)
			FoundEnimie = false
		else
			Path:ComputeAsync(Char.Position, ClosestPart.Position)
			Human:MoveTo(ClosestPart.Position)
		end
	end
	local MaxDistance = 100
	local AllParts2 = workspace.Humans:GetChildren().Torso
until false
1 Like

This is a noted script from the Inventory Demo!

           --<Services>--
local Players = game:GetService('Players') -- gets the players service
local RunService = game:GetService('RunService') -- gets the run service
local StarterGui = game:GetService('StarterGui') -- gets the starter gui service
local UserInputService = game:GetService('UserInputService') -- gets the user input service
                   --<Disable Roblox's Backpack>--
repeat -- starts a repeat
local Success, Error = pcall(function() -- wraps a pcall
		StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false) -- disables roblox's backpack
end) -- ends the pcall wrap
wait() -- waits as fast the players comuter can handle it
until Success -- ends the reapeat when we have successfully disabled roblox's backpack


--[!] const

-- max tool slot size
local TOOL_MAX_SLOTS = 10 -- sets max tool slots

-- i.e. GUI-related tool slot settings
local TOOL_SIZE = 50            -- tool icon size
local TOOL_BORDER_OFFSET = 15   -- gap between icons
local TOOL_BOTTOM_OFFSET = 20   -- offset from bottom of screen

-- keycode values, see here: https://create.roblox.com/docs/reference/engine/enums/KeyCode
--
--    where:
--      48 = Zero
--      49 = One
--       n = ...
--      57 = Nine
--
local NUMERIC_KEYCODE_ZRO = 48 -- gets the zero keycode
local NUMERIC_KEYCODE_MIN = 49 -- gets the minimum keycode for our keycodes(1)
local NUMERIC_KEYCODE_MAX = 57 -- gets the maximum keycode for our keycodes(9)

local NUMERIC_KEYCODE_RANGE = NumberRange.new(NUMERIC_KEYCODE_MIN, NUMERIC_KEYCODE_MAX) -- i.e. the range of Enum.KeyCode[name].Value that represents numeric keycodes

-- i.e. set up a dictionary that maps the value to a specific keycode
local KEYCODE_VALUES = { } -- creates a table
for _, keycode in next, Enum.KeyCode:GetEnumItems() do -- gets all the keycodes
	KEYCODE_VALUES[keycode.Value] = keycode -- adds the keycode to the value
end -- ends when all the keycodes were goten


--[!] utils

-- checks whether a character is alive, and has valid character instances e.g. humanoid + rootpart
local function tryGetCharacterInstances(character) -- checks whether the char is alive
	if typeof(character) ~= 'Instance' or not character:IsA('Model') or not character:IsDescendantOf(workspace) then -- goes through all of the players stuff and if its not = to an instance or moddel or char is a dicendent of the workspace then
		return false -- returns and breaks the following code and returns false
	end -- this has checked whether the char is a char

	local humanoid = character:FindFirstChildOfClass('Humanoid') -- finds the players char
	local humanoidState = humanoid and humanoid:GetState() or Enum.HumanoidStateType.Dead -- gets the humoids state
	local humanoidRootPart = humanoid and humanoid.RootPart or nil -- gets the humanoid root part and humanoid
	if humanoidState == Enum.HumanoidStateType.Dead or not humanoidRootPart then -- if the humanoid is dead it runs the following
		return false -- breaks the following code and returns false
	end -- this has checked whether the character was alive

	return true, humanoid, humanoidRootPart -- if the char we are talking abt is a actual char and is alive we return true
end

-- wait until we find a valid character
local function awaitCharacter(player) -- this block of code waits untill we find a valid char
	if typeof(player) ~= 'Instance' or not player:IsA('Player') then -- checks if the player is not and instance or a player then do this
		return nil -- return nil
	end -- this has checked whether our plr was a real plr

	local character -- sets a local variable named character
	while not character do -- while character is nil do the following
		if not player or not player:IsDescendantOf(Players) then -- if it is not a player or is a decendent of a players do the following
			break -- breaks the code
		end -- this has checked if the player is a okayer or a decend of players

		local char = player.Character -- gets the plrs character
		if not char then -- if char is nil then
			player.CharacterAdded:Wait() -- wait for the character to be added
			continue -- then continues
		end -- ends the if not statment

		local valid = tryGetCharacterInstances(char) -- makes a var called valid that is just the char trying to get char instances
		if not valid then -- if valid = nil then
			RunService.Stepped:Wait() -- wait until the plr moves
			continue -- continues
		end -- this has waited until the character moves if valid = nil

		character = char -- sets character to char
	end -- this has found the characer

	return character -- returns the character
end -- this has waited for the character


--[!] methods
local function createToolSlot(parent, index, keyCode) -- this creates the plrs tool slots
	local position = index - math.ceil(TOOL_MAX_SLOTS*0.5) -- gets the possition we want this new slot
	
	local frame = Instance.new('ImageButton') -- creates a image button
	frame.Name = 'Toolslot' .. index -- we name this image button toolslot(number of slot so for exp:Toolslot1)
	frame.Size = UDim2.fromOffset(TOOL_SIZE, TOOL_SIZE) -- sets the frames size to the size we set above
	frame.Position = UDim2.new(0.5, position*(TOOL_SIZE + TOOL_BORDER_OFFSET*0.5), 1, -TOOL_BOTTOM_OFFSET) -- sets the possition to some fancy stuff that just aligns with everything else
	frame.AnchorPoint = Vector2.new(0.5, 1) -- sets the anchor point
	frame.BorderSizePixel = 1 -- gives it a anchor point
	frame.BackgroundTransparency = 0 -- sets the backround trancparency to visible
	frame.Image = '' -- sets its image to nothing
	frame.ImageTransparency = 1 -- sets the image transparency to invisible(1)

	local posLabel = Instance.new('TextLabel') -- creates a new lable
	posLabel.Name = 'PositionLabel' -- names it "PositionLable"
	posLabel.Size = UDim2.fromOffset(13, 13) -- sets its size
	posLabel.Position = UDim2.fromScale(0, 0) -- sets its possition to 0,0
	posLabel.AnchorPoint = Vector2.new(0, 0) -- sets its anchor point
	posLabel.BorderSizePixel = 1 -- sets its boarder
	posLabel.BackgroundTransparency = 1 -- makes the backround invisable
	posLabel.Text = tostring(index) -- makes the text index which is 1,9 + 0 so it could look like 1 for example
	posLabel.Parent = frame -- makes its parent to frame
	
	local StackLabel = Instance.new('TextLabel') -- creates a new lable
	StackLabel.Name = 'StackLabel' -- names it "StackLabel"
	StackLabel.Size = UDim2.fromOffset(13, 13) -- sets its size
	StackLabel.Position = UDim2.fromScale(0.8, 0.8) -- sets its possition to the bottom right corner of the frame
	StackLabel.AnchorPoint = Vector2.new(0, 0) -- sets its anchor point
	StackLabel.BorderSizePixel = 1 -- sets its boarder
	StackLabel.BackgroundTransparency = 1 -- sets the backround invisisble
	StackLabel.Transparency = 1 -- sets the label to invisible
	StackLabel.Text = 0 -- sets its text to 0
	StackLabel.Parent = frame -- sets its parent to frame

	local toolLabel = Instance.new('TextLabel') -- creates a new label
	toolLabel.Name = 'ToolLabel' -- names it "toollabel"
	toolLabel.Size = UDim2.new(1, 0, 0, 25) -- sets its size
	toolLabel.Position = UDim2.fromScale(0.5, 0.5) -- sets its position 
	toolLabel.AnchorPoint = Vector2.new(0.5, 0.5) -- sets its anchor point
	toolLabel.BorderSizePixel = 1 -- sets its boarder
	toolLabel.TextColor3 = Color3.fromHSV(0.98, 0.7, 0.75) -- sets the text collor to red
	toolLabel.BackgroundTransparency = 1 -- sets its backround transparency
	toolLabel.Text = '' -- sets its text to nothing
	toolLabel.Parent = frame -- sets its parent to frame
	toolLabel.TextScaled = true -- sets the textscaled to true

	frame.Parent = parent -- sets the frames parent to the screen gui(parent)
	return frame, toolLabel -- returns frame and toolLabel
end -- this created the players tool slots


-- used to check whether the tool is still within the
-- player's backpack / their character; and if not, will remove
-- it from the slots e.g. in cases where they pressed backspace to drop the tool
--
local function handleToolRemoval(player, toolSlots, object, connection) -- when the tool is being removed it does this
	-- make sure we've not just equipped the tool
	local character = player.Character -- sets a var named character to the pltd char
	if object:IsDescendantOf(player) or (character and object:IsDescendantOf(character)) then -- if the object is a desendent of the player or character and is a descendantof the character it does the following
		return -- returns the script
	end -- this has checked if the object is a desendent of the player or character and is a descendantof the character and if it is it returns

	-- find the tool slot so we can remove it
	local toolSlot -- this makes a variable names toolSlot
	for i = 1, TOOL_MAX_SLOTS, 1 do -- goes through all the tool slots 
		local slot = toolSlots[i] -- gets the toolslot
		if slot.Tool == object then -- if the tool in the toolslot is == to the object(the tool) then
			toolSlot = slot -- sets the toolslot to the slot
			break -- breaks the code
		end
	end
	                                                                   --<NOTE>--
	-- Ive goten tired of noting every single line so ima stop noting every single line and only note the lines i feel are not obvious what they do(Sorry)
	-- stop listening to this tool's ancestry since it's been not related to our player now
	if connection and connection.Connected then 
		connection:Disconnect() -- disables the connection
	end
end
local function RemoveToolSlot(toolSlot) -- starts a function names "RemoveToolSlot"
	if toolSlot then -- if the toolslot is not == nil then
		-- just resets the toolslot
		toolSlot.Tool = nil
		toolSlot.Label.Text = ''
	end
end

-- used to add the tool to the next best slot
-- if not already present
--
local function handleToolAdded(player, toolSlots, object, FromCharacter) -- this handels when the tool is added
	if not object:IsA('Tool') then
		return
	end
	-- make sure we don't already exist
	-- otherwise select next best empty slot
	local CreateNewSlot = true
	local NewItem = object.NewItem -- this is a value in all the items
	if FromCharacter == true then -- multiple things fire for this so this would run 2 times instead it only runs when it fires from the char added (youl see later)
		if NewItem.Value == true then -- if this is a new item that hasnt been picked up before (This makes sure when you togle(Equip And Unequip) an item it has just been picked up)
			NewItem.Value = false -- says we have alr picked this up
	for i,item in pairs(Players.LocalPlayer.Character:GetChildren()) do -- runs through all the chars items to find the tool
		if item:IsA("Tool") then
			for i, S in pairs(script.Parent:GetChildren()) do -- runs through the guis children
				if S:IsA("ImageButton") then -- checks if its a slot
					if S.ToolLabel.Text == item.Name then -- checks if the item is equipted in the toolabel
						S.StackLabel.Transparency = true
						if S.StackLabel.Text == "0" then
							S.StackLabel.Text = 2 -- adds 2 because it doesent count when you get 1 because it doesent play this (it has to do with the slot creation it creates a slot when the new item was Just added)
							CreateNewSlot = false -- sets create new slot to false because we dont need a new slot
						else -- if stackLabel.Text is ablove 0 then
									S.StackLabel.Text = tonumber(S.StackLabel.Text) + 1 -- adds the Stacklabel text + 1
									CreateNewSlot = false -- we dont need a new slot
						end
					end
				end
			end
		end
	end
		if CreateNewSlot == true then -- checks if we need a new slot
			local bestSlot -- sets a value names best slot
			for i = 1, TOOL_MAX_SLOTS, 1 do -- loops through all the slots
				local slot = toolSlots[i] -- finds the slot
				if slot.Tool == object then -- if the slot is alr Ocupied we return
					return
				elseif not bestSlot and not slot.Tool then -- checks if the slot has no other item inside it
					bestSlot = i -- sets the bestslot to i
				end
			end
			if bestSlot then -- if we have a bestslot then
				-- i.e. we're a new tool
				-- gives the bestslot the properties of the item it needs
				bestSlot = toolSlots[bestSlot]
				bestSlot.Tool = object
				bestSlot.Label.Text = object.Name
			end
		end
		end
		end
		-- watch the ancestry of the object (i.e. it's parent)
		-- to check when the player removes the tool from its backpack
		-- and/or its character
		local watchdog 
		watchdog = object.AncestryChanged:Connect(function ()
			handleToolRemoval(player, toolSlots, object, watchdog)
		end)
		end


--[!] setup
local player = Players.LocalPlayer -- makes a variable and sets it to player
local backpack = player:WaitForChild('Backpack') -- makes a variable and sets it to backpack
local character = awaitCharacter(player) -- makes a variable and sets it to the plrs character
local screenGui = script.Parent -- sets a variable and names it screengui


-- states
local toolSlots = table.create(TOOL_MAX_SLOTS)  -- i.e. all of the tool slots
local toolSlotMap = { }                         -- i.e. a map between a keycode and a tool slot

local selectedToolSlot                          -- the tool slot we're trying to swap
local isChangingKeybinds = false                -- whether we're trying to change our keybinds


-- set up our keybind slots
for i = 1, TOOL_MAX_SLOTS, 1 do -- loop through all the slots
	-- get the KeyCode from the slot number
	local keyCode
	if i == TOOL_MAX_SLOTS then -- if i = the max slot then its keycode is == 0
		keyCode = KEYCODE_VALUES[NUMERIC_KEYCODE_ZRO]
	else -- if i is not = max tool slots sets the keycode
		keyCode = KEYCODE_VALUES[NUMERIC_KEYCODE_MIN + (i - 1)]
	end

	-- set up the slot
	local slot, toolLabel = createToolSlot(screenGui, i, keyCode)
	-- append to our list
	toolSlots[i] = { -- sets the tool slots up
		Tool = nil,
		Slot = slot,
		Label = toolLabel,
		ScreenGui = screenGui,
		Index = i,
		KeyCode = keyCode,
	}
	toolSlotMap[keyCode] = i

	-- set up the listener
	slot.MouseButton1Click:Connect(function () -- if the slot is clicked
		-- set the selected one to our current slot
		-- if we aren't already trying to change it
		if not isChangingKeybinds then -- if this is the first click it sets some things and returns
			isChangingKeybinds = true
			selectedToolSlot = i
			return
		end
-- if this is the secont time it swaps the the neccessary data between the 2 slots
		local StackLabels = {screenGui.Toolslot1.StackLabel, screenGui.Toolslot2.StackLabel, screenGui.Toolslot3.StackLabel, screenGui.Toolslot4.StackLabel,screenGui.Toolslot5.StackLabel,
			screenGui.Toolslot6.StackLabel, screenGui.Toolslot7.StackLabel, screenGui.Toolslot8.StackLabel,screenGui.Toolslot9.StackLabel, screenGui.Toolslot10.StackLabel}
		-- swap our slots around
		local swapSlot = toolSlots[selectedToolSlot]
		local thisSlot = toolSlots[i]

		-- swap our tool reference around
		thisSlot.Tool, swapSlot.Tool = swapSlot.Tool, thisSlot.Tool

		-- swap the label text around
		thisSlot.Label.Text, swapSlot.Label.Text = swapSlot.Label.Text, thisSlot.Label.Text
		
		-- swap the transparency around
		StackLabels[i].Transparency, StackLabels[selectedToolSlot].Transparency = StackLabels[selectedToolSlot].Transparency, StackLabels[i].Transparency
		
		-- swap the stack nums around
		StackLabels[i].Text, StackLabels[selectedToolSlot].Text = StackLabels[selectedToolSlot].Text, StackLabels[i].Text
		isChangingKeybinds, selectedToolSlot = false, nil
	end)
end


-- set up our input action(s)
UserInputService.InputBegan:Connect(function (input, gameProcessed) -- when the player begins an imput it fires this
	local inputType = input.UserInputType -- gets the imput type
	if gameProcessed or inputType ~= Enum.UserInputType.Keyboard then
		return
	end

	-- ignore if we're dead
	local isValid, humanoid = tryGetCharacterInstances(character)
	if not isValid then -- if we cant get the characters instances it just returns
		return
	end
	-- try to get the slot from the keycode and ignore if it doesn't exist
	local keyCode = input.KeyCode -- just sets the keycode
	local slotIndex = toolSlotMap[keyCode] -- gets the imputs with the keycodes
	local toolSlot = slotIndex and toolSlots[slotIndex] or nil -- gets the toolslots and slotIndex
	if keyCode == Enum.KeyCode.Q then -- when the player clicks Q
		for i, Item in pairs(Players.LocalPlayer.Character:GetChildren()) do -- runs through all the chars items
			if Item:IsA("Tool") then -- if its a tool do the following
				for i, ItemSlot in pairs(script.Parent:GetChildren()) do -- goes through the screen gui
					if ItemSlot:IsA("ImageButton") then -- if its an slot then
						if ItemSlot.ToolLabel.Text == Item.Name then -- if the toolabel.text = to the items name then(in other words if the slot is ocupied by the item)
							if tonumber(ItemSlot.StackLabel.Text) == 0 then -- if stacklabel is 0 then we just reset the slot
								ItemSlot.StackLabel.Text = 0 
								for i, Item in pairs(Players.LocalPlayer.Character:GetChildren() and Players.LocalPlayer.Backpack:GetChildren()) do -- go through all the players tools
									if Item:IsA("Tool") then
										if Item.Name == ItemSlot.ToolLabel.Text then -- if its a stacked item then we reset some stuff
											toolSlots[tonumber(ItemSlot.PositionLabel.Text)].Label.Text = ""
											toolSlots[tonumber(ItemSlot.PositionLabel.Text)].Tool = nil
											Item:Destroy() -- Replace this with what you want to do I.E sell the item or drop the item (realy whatever you want)
											humanoid:UnequipTools() -- unequipt the players tools
										end
									end
								end
							elseif tonumber(ItemSlot.StackLabel.Text) == 2 then -- else if its == 2 then we set it the propertys of if you had 1 item
								ItemSlot.StackLabel.Text = 0
								ItemSlot.StackLabel.Transparency = 1
							elseif tonumber(ItemSlot.StackLabel.Text) >= 2 then -- else if it just subtracts 1 from the stacklabel
								ItemSlot.StackLabel.Text = tonumber(ItemSlot.StackLabel.Text) - 1
							end
						end
					end
				end
			end
		end
	end
	if not toolSlot then -- if there isnt a toolslot being ocupied it just returns
		return
	end

	-- if we haven't got a tool for this slot we can ignore it
	local tool = toolSlot.Tool
	if not tool then -- if there isnt a toolslot.Tool being ocupied it just returns
		return
	end

	-- equip it if we're not using it;
	-- otherwise unequip it
	if tool.Parent ~= character then -- if the tools parent isnt character (its not equipt)
		humanoid:EquipTool(tool) -- it equips the tool
	else -- if its equipt then we just unequipt it
		humanoid:UnequipTools()
	end
end)


-- set up our listener(s)
--    - we need to make sure we look at those already
--      in the backback too
--
--    - we also need to make sure any tools added to the char
--      via pickup get added
--
for _, object in next, backpack:GetChildren() do -- runs through all the players backpacks chidren
	handleToolAdded(player, toolSlots, object, false) -- fires tool added
end

backpack.ChildAdded:Connect(function (object) -- when a item is added to the backpack it fires this
	handleToolAdded(player, toolSlots, object, false) -- fires tool added
end)
character.ChildAdded:Connect(function (object) -- when a new item is equipt and added to the character it fires this
	handleToolAdded(player, toolSlots, object, true) -- fires tool added
end)