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
 

How do I disable Backpack while inside the lobby?

Previous Thread :: Next Thread 
ScribeOfTheEndless is not online. ScribeOfTheEndless
Joined: 17 Sep 2016
Total Posts: 102
16 Feb 2017 12:59 AM
Hello!

I'm trying to disable the Backpack when a player is inside the Lobby. What I've done is inserted a giant invisible block that takes up the entire Lobby and inserted a local script into the block that doesn't quite work:


local Part = script.Parent
local StarterGui = game:GetService('StarterGui')

Part.Touched:connect(function(HIT)
local H = HIT.Parent:FindFirstChild("Humanoid")
if H then
local Player = game.Players:GetPlayerFromCharacter(HIT.Parent)
Player.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
end
end)


Can I get some assistance with tweaking this script? Thank you! :)
Report Abuse
ForestTrooper263I is not online. ForestTrooper263I
Joined: 24 Dec 2008
Total Posts: 38
16 Feb 2017 01:00 AM
You set it client side in a local script. Use remote events.


Report Abuse
ScribeOfTheEndless is not online. ScribeOfTheEndless
Joined: 17 Sep 2016
Total Posts: 102
16 Feb 2017 11:26 AM
Thanks for the response! Can you be a bit more specific, I've never used remote events. Thank you!
Report Abuse
KritikalGunzz is not online. KritikalGunzz
Joined: 10 Nov 2013
Total Posts: 1633
16 Feb 2017 12:01 PM
put this in a localscript under starterplayer : torso.Touched:connect(function(HIT) if H.Name ## "lool" then local Player = game.Players.LocalPlayer Player.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false) end end) reference torso correctly
Report Abuse
KritikalGunzz is not online. KritikalGunzz
Joined: 10 Nov 2013
Total Posts: 1633
16 Feb 2017 12:03 PM
put this in a localscript under starterplayer
:

torso.Touched:connect(function(HIT)

if H.Name == "backpackchanger" then
local Player = game.Players.LocalPlayer
Player.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
end
end)

reference torso correctly and change the name to the brick in the lobby to backpackchanger
Report Abuse
XCVlll is not online. XCVlll
Joined: 23 Oct 2008
Total Posts: 963
16 Feb 2017 12:12 PM
that's so ineffective and it would constantly have events firing whenever the torso touches anything
Report Abuse
XCVlll is not online. XCVlll
Joined: 23 Oct 2008
Total Posts: 963
16 Feb 2017 12:12 PM
it'd be easier to put the script inside the part and get the player from the character
Report Abuse
KritikalGunzz is not online. KritikalGunzz
Joined: 10 Nov 2013
Total Posts: 1633
16 Feb 2017 12:14 PM
yeah it has very little impact on game speed what so ever.

Plus then you dont have to use fireclient since you need to set it from a local script
Report Abuse
XCVlll is not online. XCVlll
Joined: 23 Oct 2008
Total Posts: 963
16 Feb 2017 12:17 PM
im pretty sure he's not using FE judging from his code
Report Abuse
KritikalGunzz is not online. KritikalGunzz
Joined: 10 Nov 2013
Total Posts: 1633
16 Feb 2017 12:18 PM
Player.PlayerGui*:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)


setcoregui can only be called from a localscript to work online
Report Abuse
XCVlll is not online. XCVlll
Joined: 23 Oct 2008
Total Posts: 963
16 Feb 2017 12:21 PM
i didn't realize he was changing coregui, mb
Report Abuse
XCVlll is not online. XCVlll
Joined: 23 Oct 2008
Total Posts: 963
16 Feb 2017 12:22 PM
i was thinking about a different forum
Report Abuse
ScribeOfTheEndless is not online. ScribeOfTheEndless
Joined: 17 Sep 2016
Total Posts: 102
16 Feb 2017 11:38 PM
KritikalGunzz - Thank you for the codes, but Studio doesn't like it, says:

23:38:27.169 - torso is not a valid member of Player
23:36:08.773 - Touched is not a valid member of Player


Here is the script:

local player = game.Players.LocalPlayer
player.torso.Touched:connect(function(HIT)

local H = HIT.Parent:FindFirstChild("Humanoid")
if H.Name == "backpackchanger" then

player.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
end
end)
Report Abuse
ScribeOfTheEndless is not online. ScribeOfTheEndless
Joined: 17 Sep 2016
Total Posts: 102
16 Feb 2017 11:53 PM
I made sure to define Torso, but the script doesn't seem to do anything. I have it in StarterPLayer - StarterPlayerScripts as a Local Script, and I've also tried putting it in part labeled "backpackchanger", no difference.


local player = game.Players.LocalPlayer
local torso = player:WaitForChild("Torso")

player.torso.Touched:connect(function(HIT)

local H = HIT.Parent:FindFirstChild("Humanoid")
if H.Name == "backpackchanger" then

player.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
end
end)
Report Abuse
ScribeOfTheEndless is not online. ScribeOfTheEndless
Joined: 17 Sep 2016
Total Posts: 102
17 Feb 2017 08:50 AM
Bump
Report Abuse
Gomlsauresrex is not online. Gomlsauresrex
Joined: 25 Mar 2016
Total Posts: 3588
17 Feb 2017 08:54 AM
Torso is a member of the character

fyi, dont use the torso because it doesnt exist in r15
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
17 Feb 2017 08:54 AM
local player = game.Players.LocalPlayer local char = player.Character or player.CharacterAdded:wait() local torso = char:WaitForChild('Torso') torso.Touched:connect(function(hit) local human = hit.Parent:FindFirstChild('Humanoid') ##### name is Humanoid if human.Parent.Name ## 'BackpackChanger' then --what is called backpackchanger ? game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack,false) end end)
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
17 Feb 2017 08:55 AM
--local script

local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:wait()
local torso = char:WaitForChild('Torso')

torso.Touched:connect(function(hit)
local human = hit.Parent:FindFirstChild('Humanoid') --the name is Humanoid
if human.Parent.Name == 'BackpackChanger' then --what is called backpackchanger ?
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack,false)
end
end)


Report Abuse
ScribeOfTheEndless is not online. ScribeOfTheEndless
Joined: 17 Sep 2016
Total Posts: 102
17 Feb 2017 11:09 PM
TimeTicks - Thanks for the script! 'backpackchanger' is the name of the brick that takes up the entire Lobby. I want my script to work that as long as a player is touching this brick, their backpack is disabled to prevent players from using items inside the Lobby. Where do I put this Local Script? I've ### ## ###### the 'backpackchanger' part in the Lobby, I've placed it inside the StarterPlayer, no luck. Thanks again for your help!
Report Abuse
Cytheur is not online. Cytheur
Joined: 12 Aug 2014
Total Posts: 7328
17 Feb 2017 11:11 PM
First off, if you have the local script inside of a part in game, the script won't work no matter what.

Local script won't run in that atmosphere.


Report Abuse
Lua_Basics is not online. Lua_Basics
Joined: 04 Jun 2012
Total Posts: 9977
17 Feb 2017 11:12 PM
^ He nailed it.
Report Abuse
ScribeOfTheEndless is not online. ScribeOfTheEndless
Joined: 17 Sep 2016
Total Posts: 102
17 Feb 2017 11:22 PM
Thanks for the info, how should I go about this then?
Report Abuse
ScribeOfTheEndless is not online. ScribeOfTheEndless
Joined: 17 Sep 2016
Total Posts: 102
18 Feb 2017 11:48 AM
bump.
Report Abuse
ScribeOfTheEndless is not online. ScribeOfTheEndless
Joined: 17 Sep 2016
Total Posts: 102
19 Feb 2017 01:54 PM
I could still use some help with this if anyone has any advice. :) I'd like to put the script inside the Part, so Players would have their backpacks disabled when touching it. But I'm open to other suggestions.
Report Abuse
ScribeOfTheEndless is not online. ScribeOfTheEndless
Joined: 17 Sep 2016
Total Posts: 102
19 Feb 2017 06:16 PM
bump.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 2Go to page: [1], 2 Next
 
 
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