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: How would I make my work for myself only?

Previous Thread :: Next Thread 
Meowth552 is not online. Meowth552
Joined: 17 Dec 2009
Total Posts: 2181
02 Jul 2016 02:47 PM
My current script.

function onClicked(playerWhoClicked)

----------------------------------------------------------------------------------------------------

-- Lock
if _G.locked == false and game.Players.LocalPlayer.UserId == game.CreatorId then
_G.locked = true

----------------------------------------------------------------------------------------------------

-- Unlock
elseif _G.locked == true and game.Players.LocalPlayer.UserId == game.CreatorId then
_G.locked = false

----------------------------------------------------------------------------------------------------

end
end

script.Parent.ClickDetector.MouseClick:connect(onClicked)

I have tried to make it check for if the LocalPlayer's ID is the same as the Creator, but to no avail. How would I solve this?
Report Abuse
Crimsonal is not online. Crimsonal
Joined: 23 Apr 2011
Total Posts: 1795
02 Jul 2016 02:48 PM
name check
Report Abuse
Meowth552 is not online. Meowth552
Joined: 17 Dec 2009
Total Posts: 2181
02 Jul 2016 02:55 PM
It did not work.

This is my current script after adding name checks:

function onClicked(playerWhoClicked)

----------------------------------------------------------------------------------------------------

-- Lock
if _G.locked == false and game.Players.LocalPlayer.Name == "Meowth552" then
_G.locked = true

elseif _G.locked == false and game.Players.LocalPlayer.Name ~= "Meowth552" then
wait()

----------------------------------------------------------------------------------------------------

-- Unlock
if _G.locked == true and game.Players.LocalPlayer.Name == "Meowth552" then
_G.locked = false

elseif _G.locked == true and game.Players.LocalPlayer.Name ~= "Meowth552" then
wait()

----------------------------------------------------------------------------------------------------

end
end
end

script.Parent.ClickDetector.MouseClick:connect(onClicked)
Report Abuse
Crimsonal is not online. Crimsonal
Joined: 23 Apr 2011
Total Posts: 1795
02 Jul 2016 03:02 PM
function onClicked(playerWhoClicked)

----------------------------------------------------------------------------------------------------

-- Lock
if _G.locked == false and playerWhoClicked.Name == "Meowth552" then
_G.locked = true

elseif _G.locked == false and playerWhoClicked.Name ~= "Meowth552" then
wait()

----------------------------------------------------------------------------------------------------

-- Unlock
if _G.locked == true and playerWhoClicked.Name == "Meowth552" then
_G.locked = false

elseif _G.locked == true andplayerWhoClicked.Name ~= "Meowth552" then
wait()

----------------------------------------------------------------------------------------------------

end
end
end

script.Parent.ClickDetector.MouseClick:connect(onClicked)




By the way make sure you're not in test mode because if you are roblox assigns your name to Player or Player1
Report Abuse
Meowth552 is not online. Meowth552
Joined: 17 Dec 2009
Total Posts: 2181
02 Jul 2016 03:08 PM
Ah, test mode was the issue.

Thanks for the help! =)
Report Abuse
Meowth552 is not online. Meowth552
Joined: 17 Dec 2009
Total Posts: 2181
02 Jul 2016 03:30 PM
Seems it is still not working.

function onClicked(playerWhoClicked)

----------------------------------------------------------------------------------------------------

-- Lock
if _G.locked == false and playerWhoClicked.Name == "Player1" then
_G.locked = true

elseif _G.locked == false and playerWhoClicked.Name ~= "Player1" then
wait()

----------------------------------------------------------------------------------------------------

-- Unlock
if _G.locked == true and playerWhoClicked.Name == "Player1" then
_G.locked = false

elseif _G.locked == true and playerWhoClicked.Name ~= "Player1" then
wait()

----------------------------------------------------------------------------------------------------
end
end
end

script.Parent.ClickDetector.MouseClick:connect(onClicked)
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
02 Jul 2016 03:41 PM
For someone who keeps their scripts apart for tidyness, your script is organized rather ugly.
Report Abuse
Meowth552 is not online. Meowth552
Joined: 17 Dec 2009
Total Posts: 2181
02 Jul 2016 03:43 PM
@Above

For someone who keeps whining about how others should do things, your opinions are rather useless.
Report Abuse
Meowth552 is not online. Meowth552
Joined: 17 Dec 2009
Total Posts: 2181
02 Jul 2016 03:43 PM
Also, if you have complaints, please do tidy my script up. Thanks! =)
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
02 Jul 2016 03:46 PM
Your original script should look like this:

function onClicked(playerWhoClicked)
if _G.locked == false and game.Players.LocalPlayer.UserId == game.CreatorId then
_G.locked = true
elseif _G.locked == true and game.Players.LocalPlayer.UserId == game.CreatorId then
_G.locked = false
end
end



And you should combine those 2 scripts that you're using _G.locked for because it looks ugly using _G.locked so much :)
Report Abuse
Meowth552 is not online. Meowth552
Joined: 17 Dec 2009
Total Posts: 2181
02 Jul 2016 03:50 PM
I can't combine the two scripts because I have no idea how to detect clicks on another part and then implement it into my script. =)
Report Abuse
HalfPinky456 is not online. HalfPinky456
Joined: 10 Apr 2011
Total Posts: 6236
02 Jul 2016 04:11 PM
war, chill out
he just didn't use your idea.
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
02 Jul 2016 04:14 PM
'I can't combine the two scripts because I have no idea how to detect clicks on another part and then implement it into my script. =)'

Just set up a second MouseClick event on a different part. I'll show you how if you want, it's really simple :)


@Above It wasn't an idea, it was the proper way to do something. I'm trying to help him organize his code so it's more readable.
Report Abuse
HalfPinky456 is not online. HalfPinky456
Joined: 10 Apr 2011
Total Posts: 6236
02 Jul 2016 04:17 PM
sorry, i was in the wrong there
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