I've clicked on everything in roblox studio once (not double click) and I don't know where or how to insert my script.
im trying to insert a script that goes like:
print("Script by IHaveALEGOCollection")
for i, v in pairs(script:GetChildren()) do if v:IsA("ScreenGui") then v.Parent = game.StarterGui end end -- ^ makes sure the stuff inside the script goes into the starter GUI :)
-- this script runs admin commands for my trusted friends and also gives out the stats! Banned = {} -- noobs here Admins = {"Catsarecool23", "Cogsarecool", "xjurwi", "Baseballboy6666", "boring", "ExclusiveKeith", "iEnzo3"} -- friends :3 Owner = "Lightmaster9" -- the creator of this place!
-- LEVEL AND XP --
function XPchange(player, x, l) if x.Value >= l.Value * 50 then l.Value = l.Value + 1 end end
function Levelup(player, x, l) x.Value = 0 player.Character.Humanoid.MaxHealth = l.Value100 player.Character.Humanoid.Health = l.Value100 local m = Instance.new("Message") m.Text = player.Name .. " is now level " .. l.Value m.Parent = workspace wait(2) m:Remove() end
-- LEVEL AND XP --
-- admin player
db = false
function openMenuAdmin(player) local Gui = player.PlayerGui.Admin.Menu for i, v in pairs(Gui:GetChildren()) do if v.Visible == true then v.Visible = false else v.Visible = true end end end
page = 1 AC = {"Kill the player", "Make the player jump", "Make the player sit down", "Force field (removes if the player has it)"}
function changePage(player) local Gui = player.PlayerGui.Admin.Menu local Wish = Gui.Wish local Page = Gui.Page max = #AC + 1 -- i can now edit the commands without having to change this :) page = page + 1 -- print("Page: " .. page) if page == max then page = 1 Wish.Text = AC[page] -- just checking if the page is at its max. else if page == 1 then Wish.Text = AC[page] end if page == 2 then Wish.Text = AC[page] end if page == 3 then Wish.Text = AC[page] end if page == 4 then Wish.Text = AC[page] end end end
-- add more commands later
db2 = false
function OnePlayer(player)
local Gui = player.PlayerGui.Admin.Menu
local Scan = Gui.Scan
local Write = Gui.PlayerWrite
local Submit = Gui.Submit
local Wish = Gui.Wish
local Page = Gui.Page
if not db2 then
for i = 1, 5 do
Scan.Text = "Scanning"
wait(.05)
Scan.Text = ".Scanning."
wait(.05)
Scan.Text = "..Scanning.."
wait(.05)
Scan.Text = "...Scanning..."
wait(.05)
Scan.Text = "..Scanning.."
wait(.05)
Scan.Text = ".Scanning."
wait(.05)
end
local victim = game.Players:findFirstChild(Write.Text)
if victim == nil then
Scan.Text = "Error! Player is not found."
wait(3)
Scan.Text = "No scan in progress"
else
if page == 1 then
Scan.Text = victim.Name .. " was killed"
-- print("Worked") <- just for tests
victim.Character.Humanoid.Health = nil
wait(3)
Scan.Text = "No scan in progress"
end
if page == 2 then
Scan.Text = victim.Name .. " has jumped"
victim.Character.Humanoid.Jump = true
wait(3)
Scan.Text = "No scan in progress"
end
if page == 3 then
Scan.Text = victim.Name .. " has been seated"
victim.Character.Humanoid.Sit = true
wait(3)
Scan.Text = "No scan in progress"
end
if page == 4 then
if victim.Character:findFirstChild("ForceField") == nil then
Scan.Text = victim.Name .. " has been been given a force field"
local f = Instance.new("ForceField")
f.Parent = victim.Character
wait(3)
Scan.Text = "No scan in progress"
else
Scan.Text = victim.Name .. "'s force field is now gone"
victim.Character:findFirstChild("ForceField"):Remove()
wait(3)
Scan.Text = "No scan in progress"
end
end
end
end
db2 = false
end
-- admin player
-- player ban part
db = false
function openMenu(player) local Gui = player.PlayerGui.Bans.Menu for i, v in pairs(Gui:GetChildren()) do if v.Visible == true then v.Visible = false else v.Visible = true end end end
function Banning(player) local Gui = player.PlayerGui.Bans.Menu local Scan = Gui.Scan local Write = Gui.PlayerWrite local Submit = Gui.Submit if not db then for i = 1, 5 do Scan.Text = "Scanning" wait(.05) Scan.Text = ".Scanning." wait(.05) Scan.Text = "..Scanning.." wait(.05) Scan.Text = "...Scanning..." wait(.05) Scan.Text = "..Scanning.." wait(.05) Scan.Text = ".Scanning." wait(.05) end if Write.Text == Owner then Scan.Text = "Why are you trying to ban yourself?" wait(3) Scan.Text = "No scan in progress." return false end if game.Players:findFirstChild(Write.Text) ~= nil then game.Players:findFirstChild(Write.Text):Remove() table.insert(Banned, Write.Text) local m = Instance.new("Message") Scan.Text = "Ban successful!" m.Text = "The owner has banned " .. Write.Text m.Parent = workspace wait(5) m:Remove() Scan.Text = "No scan in progress." else Scan.Text = "Error! Player is not found." wait(3) Scan.Text = "No scan in progress." end end db = false end
-- player ban part
function banCheck(name) for i, v in pairs(Banned) do if name == v then return true end end end
function adminCheck(name) for i, v in pairs(Admins) do if name ~= Owner then if name == v.Name then local m = Instance.new("Message") m.Text = name .. " is an admin." m.Parent = workspace wait(5) m:Remove() return true else print("Not an admin") end else print("The owner is here!") return true end end end
-- respawn script --
function respawn(player) wait(1) local check = adminCheck(player.Name) if not check then player.PlayerGui.Admin:Remove() else local Gui = player.PlayerGui.Admin.Menu Gui.MouseButton1Click:connect(function() openMenuAdmin(player) end) Gui.Submit.MouseButton1Click:connect(function() OnePlayer(player) end) Gui.Page.MouseButton1Click:connect(function() changePage(player) end) end if player.Name ~= Owner then BanGui:Remove() else local Gui = player.PlayerGui.Bans.Menu Gui.MouseButton1Click:connect(function() openMenu(player) end) Gui.Submit.MouseButton1Click:connect(function() Banning(player) end) print("Owner has access to the ban GUI") end local hp = player.Character:findFirstChild("Health") if hp == nil then return false else hp:Remove() end player.Character.Humanoid.MaxHealth = player.Level.Value100 player.Character.Humanoid.Health = player.Level.Value100 end
-- respawn script --
function enter(newPlayer) wait(1) local hp = newPlayer.Character:findFirstChild("Health") if hp == nil then return false else hp:Remove() end local BanGui = newPlayer.PlayerGui:findFirstChild("Bans") if banCheck(newPlayer.Name) then newPlayer.Character:Remove() newPlayer:Remove() end -- banned palyers may not enter! local check = adminCheck(newPlayer.Name) if not check then newPlayer.PlayerGui.Admin:Remove() else local Gui = newPlayer.PlayerGui.Admin.Menu Gui.MouseButton1Click:connect(function() openMenuAdmin(newPlayer) end) Gui.Submit.MouseButton1Click:connect(function() OnePlayer(newPlayer) end) Gui.Page.MouseButton1Click:connect(function() changePage(newPlayer) end) print("An admin or owner has entered") end if newPlayer.Name ~= Owner then BanGui:Remove() else local m = Instance.new("Message") m.Text = "The creator, " .. Owner .. ", is here!" m.Parent = workspace wait(5) m:Remove() local Gui = newPlayer.PlayerGui.Bans.Menu Gui.MouseButton1Click:connect(function() openMenu(newPlayer) end) Gui.Submit.MouseButton1Click:connect(function() Banning(newPlayer) end) print("Owner has access to the ban GUI") end -- badge space -- badge space local lev = Instance.new("IntValue", newPlayer) local points = Instance.new("IntValue", newPlayer) local xp = Instance.new("IntValue", newPlayer) xp.Name = "XP" lev.Name = "Level" points.Name = "Gold" lev.Value = 1 xp.Value = 0 points.Value = 0 print("Inserted") newPlayer.Character.Humanoid.MaxHealth = newPlayer.Level.Value100 newPlayer.Character.Humanoid.Health = newPlayer.Level.Value100 xp.Changed:connect(function() XPchange(newPlayer, xp, lev) end) lev.Changed:connect(function() Levelup(newPlayer, xp, lev) end) newPlayer.Changed:connect(function(property) if property == "Character" then respawn(newPlayer) end end) print("DONE") end
game.Players.ChildAdded:connect(enter)
for i, v in pairs(game.Players:GetChildren()) do enter(v) end
while wait() do for i, v in pairs(game.Players:GetChildren()) do if v.Character ~= nil and v:findFirstChild("Gold") ~= nil then local hum = v.Character:findFirstChild("Humanoid") local gui = v.PlayerGui.Stats gui.Health.Bar.Size = UDim2.new(0,((hum.Health/hum.MaxHealth)200),0,15) gui.Health.txt.Text = "Health: " .. hum.Health .. "/" .. hum.MaxHealth gui.XP2.Bar.Size = UDim2.new(0,((v.XP.Value/v.Level.Value)4),0,15) gui.XP2.txt.Text = "XP: " .. v.XP.Value .. "/" .. v.Level.Value*50 gui["Gold+Level"].Text = "Gold: " .. v.Gold.Value .. ", Level: " .. v.Level.Value end end end
So you right click where you want to insert the script(In workspace, a part, etc.) the click "Insert Basic Object". Then click on Script or Local Script. This isn't a scripting question but it has do with scripts.
You need to open the command bar and type in,
Instance.new("Script", workspace) --Or LocalScript. Replace workspace where you want to insert the script
Open "View" on the top of the screen and click "Command Bar" then type in the code.
Hope it helps!