|
| 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 |
|
|
|
| 16 Feb 2017 01:00 AM |
You set it client side in a local script. Use remote events.
|
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 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
|
  |
| 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
|
  |
| Joined: 23 Oct 2008 |
| Total Posts: 963 |
|
|
| 16 Feb 2017 12:22 PM |
| i was thinking about a different forum |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
| |
|
|
| 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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|
| |
|
|
| 17 Feb 2017 11:22 PM |
| Thanks for the info, how should I go about this then? |
|
|
| Report Abuse |
|
|
| |
|
|
| 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 |
|
|
| |
|