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 » Scripting Helpers
Home Search
 

Re: why is this not working?

Previous Thread :: Next Thread 
zaniac10 is not online. zaniac10
Joined: 18 Aug 2009
Total Posts: 10000
16 Nov 2014 03:01 PM
local db = false

script.Parent.Touched:connect(function(hit)
local plr = game:service("Players"):GetPlayerFromCharacter(hit.Parent)
if plr:GetRankInGroup(1203527) >= 75 then
if db == true then return; end
db = true
script.Parent.Transparency = 0.6
script.Parent.CanCollide = false
wait(1)
script.Parent.Transparency = 0
script.Parent.CanCollide = true
db = false
else
return print("Player not HR, ending function.")
end
end)

if the player has a rank of 75 and up, it'll allow them to access the door. if they're not, it'll end the function.
Report Abuse
zaniac10 is not online. zaniac10
Joined: 18 Aug 2009
Total Posts: 10000
16 Nov 2014 03:02 PM
output error:

12:58:23.166 - Workspace.owneronlydoor.OwnerOnlyDoor.Script:5: attempt to index local 'plr' (a nil value)
Report Abuse
Uraganul77 is not online. Uraganul77
Joined: 19 Nov 2010
Total Posts: 177
16 Nov 2014 03:02 PM
I think you need to put rank name not number.
Report Abuse
zaniac10 is not online. zaniac10
Joined: 18 Aug 2009
Total Posts: 10000
16 Nov 2014 03:03 PM
that's whet GetRoleInGroup does

GetRankInGroup gets their permission number.
Report Abuse
Uraganul77 is not online. Uraganul77
Joined: 19 Nov 2010
Total Posts: 177
16 Nov 2014 03:04 PM
Well i dont know...
Report Abuse
zaniac10 is not online. zaniac10
Joined: 18 Aug 2009
Total Posts: 10000
16 Nov 2014 03:04 PM
it might be vice versa idk
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
16 Nov 2014 03:05 PM
Check if plr is nil first.
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
16 Nov 2014 03:06 PM
And if it was vice versa, it would error. And I'm sure you checked the output?
Report Abuse
zaniac10 is not online. zaniac10
Joined: 18 Aug 2009
Total Posts: 10000
16 Nov 2014 03:06 PM
local db = false

script.Parent.Touched:connect(function(hit)
local plr = game:service("Players"):GetPlayerFromCharacter(hit.Parent)
if plr:GetRoleInGroup(1203527) >= 75 then
if db == true then return; end
if plr ~= nil then
db = true
script.Parent.Transparency = 0.6
script.Parent.CanCollide = false
wait(1)
script.Parent.Transparency = 0
script.Parent.CanCollide = true
db = false
else
return print("Player not HR, ending function.")
end
end
end)

output error:


13:06:38.492 - Workspace.owneronlydoor.OwnerOnlyDoor.Script:5: attempt to index local 'plr' (a nil value)
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
16 Nov 2014 03:09 PM
Yep. check if it is nil.
Report Abuse
zaniac10 is not online. zaniac10
Joined: 18 Aug 2009
Total Posts: 10000
16 Nov 2014 03:10 PM
.. How?
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
16 Nov 2014 03:11 PM
if plr then
--Do stuff
end
Report Abuse
zaniac10 is not online. zaniac10
Joined: 18 Aug 2009
Total Posts: 10000
16 Nov 2014 03:20 PM
local db = false

script.Parent.Touched:connect(function(hit)
local plr = game.Players:findFirstChild(hit.Parent.Name)
if plr:GetRoleInGroup(1203527) >= 75 then
if plr then
if db == true then return; end
db = true
script.Parent.Transparency = 0.6
script.Parent.CanCollide = false
wait(1)
script.Parent.Transparency = 0
script.Parent.CanCollide = true
db = false
else
return print("Player not HR, ending function.")
end
end
end)


has still not worked.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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