generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: need some serious help with scripting this..

Previous Thread :: Next Thread 
D3ADXxXMUS1C is not online. D3ADXxXMUS1C
Joined: 21 Dec 2013
Total Posts: 11
20 Jul 2016 07:44 AM
so yea I was trying to make a script but this is what I made..


admin = {"gogomonkey69"}

if player == 1 #admin do
player.NewInstance(game.Lighting.MLG)

but it doesn't work, i'm trying to give this item called "mlg" to our leader in the game, but I can't seem to do so, I just want him to have it whenever he joins the game, him and noone else but him, thanks in advance (im new to scripting and I know basically nothing about it)
Report Abuse
Cinnace is not online. Cinnace
Joined: 21 Jun 2016
Total Posts: 370
20 Jul 2016 07:46 AM
if player == 1 #admin do


what the hell


- Cinnace
Report Abuse
Cinnace is not online. Cinnace
Joined: 21 Jun 2016
Total Posts: 370
20 Jul 2016 07:48 AM
local admins = {}

local isAdmin = function(playerObj)
for i,v in ipairs(admins) do
if type(v) == 'number' then
if playerObj.UserId == v then
return true
end
elseif type(v) == 'string' then
if playerObj.Name:lower() == v:lower() then
return true
end
end
end
return false
end


- Cinnace
Report Abuse
D3ADXxXMUS1C is not online. D3ADXxXMUS1C
Joined: 21 Dec 2013
Total Posts: 11
20 Jul 2016 07:52 AM
what does that code do? I don't need to be given something, I want to learn
Report Abuse
D3ADXxXMUS1C is not online. D3ADXxXMUS1C
Joined: 21 Dec 2013
Total Posts: 11
20 Jul 2016 07:53 AM
given something as in just a straight up code, I really wanna learn what it does, like break it down, its cool if you don't want to but still xD
Report Abuse
SenseiWarrior is online. SenseiWarrior
Joined: 09 Apr 2011
Total Posts: 12140
20 Jul 2016 07:55 AM
i think you should still keep learning before doing this

'player == 1 #admin' isnt even close


Report Abuse
D3ADXxXMUS1C is not online. D3ADXxXMUS1C
Joined: 21 Dec 2013
Total Posts: 11
20 Jul 2016 07:58 AM
well what do you think im doing
im trying to learn
Report Abuse
BothAngles is not online. BothAngles
Joined: 01 Dec 2011
Total Posts: 9604
20 Jul 2016 08:01 AM
that code is self-explanatory
just give up
Report Abuse
AggressiveCatch is not online. AggressiveCatch
Joined: 17 Jul 2011
Total Posts: 5840
20 Jul 2016 08:04 AM
local admins = {} --table of admins

local isAdmin = function(playerObj) --function isAdmin with player argument
for i,v in ipairs(admins) do --loops through the admins table on the 1st line
if type(v) == 'number' then --if the data in the table is a number
if playerObj.UserId == v then --check if player's userID matches
return true --return that player is an admin
end --end if statement
elseif type(v) == 'string' then --if data in the table is a string
if playerObj.Name:lower() == v:lower() then --lowercase both strings and compare
return true --return true if player is an admin
end --end if statement
end --end bigger if statement
end --end loop
return false --return not an admin if none of previous checks returned true
end --end the function

--call it like this

isAdmin(player)
Report Abuse
DurstAuric is online. DurstAuric
Joined: 12 May 2009
Total Posts: 8066
20 Jul 2016 08:27 AM
Your table is correct. "if player == 1 #admin do" What is that? Why do you need the length of the table and why is that 1 there. "player.NewInstance(game.Lighting.MLG)" I hope this is a function of your own. Also, don't use the lighting. Bad idea. Use ServerStorage or ReplicatedStorage instead.


( ͡• ◡ ͡•) -=[ RAP: 360,838 || DurstAuric; the narb of ROBLOX ]=- ( ͡• ◡ ͡•)
Report Abuse
D3ADXxXMUS1C is not online. D3ADXxXMUS1C
Joined: 21 Dec 2013
Total Posts: 11
20 Jul 2016 02:12 PM
thank you
Report Abuse
D3ADXxXMUS1C is not online. D3ADXxXMUS1C
Joined: 21 Dec 2013
Total Posts: 11
20 Jul 2016 02:12 PM
so instead of lighting it would be serverstorage?
Report Abuse
D3ADXxXMUS1C is not online. D3ADXxXMUS1C
Joined: 21 Dec 2013
Total Posts: 11
20 Jul 2016 02:16 PM
@agressiveclutch
so you have this code, but lets say I only want the admin to have a specific item, such as the mlg, how would I add that to this code?

local admins = {"D3ADXxXMUS1C"} --table of admins

local isAdmin = function(playerObj) --function isAdmin with player argument
for i,v in ipairs(admins) do --loops through the admins table on the 1st line
if type(v) == 'number' then --if the data in the table is a number
if playerObj.UserId == v then --check if player's userID matches
return true --return that player is an admin
end --end if statement
elseif type(v) == 'string' then --if data in the table is a string
if playerObj.Name:lower() == v:lower() then --lowercase both strings and compare
return true --return true if player is an admin
end --end if statement
end --end bigger if statement
end --end loop
return false --return not an admin if none of previous checks returned true
end --end the function
Report Abuse
AggressiveCatch is not online. AggressiveCatch
Joined: 17 Jul 2011
Total Posts: 5840
20 Jul 2016 02:18 PM
local mlg = game.Lighting.MLG -- you should use replicatedstorage or serverstorage instead btw

game.Players.PlayerAdded:connect(function(p)
if not isAdmin(p) then return end
p.CharacterAdded:connect(function(c)
mlg:Clone().Parent = c
end)
end)

Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image