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: How To Access Player Backpack

Previous Thread :: Next Thread 
SpazzMan502 is not online. SpazzMan502
Joined: 01 Aug 2013
Total Posts: 2397
03 Sep 2014 07:30 PM
So I have a script and it's almost working.

But the output says

Backpack is not a valid member of Model

And What that means is it's trying to access the player MODEL, which has clothes and stuff, but the player in PLAYERS category has backpack, gui, etc...

please help
Report Abuse
donovanisawesome is not online. donovanisawesome
Joined: 18 Aug 2010
Total Posts: 548
03 Sep 2014 07:38 PM
In your script, say give this player a shirt

give.mrbutterman.Character.shirt <--- That wont work, but it is just an example. Say "Character" right after the defined player. Hope dis helped <3
Report Abuse
SpazzMan502 is not online. SpazzMan502
Joined: 01 Aug 2013
Total Posts: 2397
03 Sep 2014 07:43 PM
No, That's not what I'm looking for.
I think I can use it somehow

But what I needed was whoever touches a brick, it disables a script in the player's backpack. The backpack is in players, not workspace.

The shirt is in Workspace, but backback, playergui, and that stuff is in Players.
Report Abuse
masterblokz is not online. masterblokz
Joined: 17 Nov 2010
Total Posts: 9517
03 Sep 2014 07:43 PM
Donovan you're really not helping anyone in SH right now you should learn how to script first

spazz Backpack belongs to player not character
Report Abuse
donovanisawesome is not online. donovanisawesome
Joined: 18 Aug 2010
Total Posts: 548
03 Sep 2014 07:47 PM
Master, why don't you chill? I was just trying to help :'c
Report Abuse
CLIMAXIMUS is not online. CLIMAXIMUS
Joined: 22 Jun 2012
Total Posts: 1738
03 Sep 2014 07:50 PM
Simply because "Backpack" is a part of player, not character.
GetPlayerFromCharacter(player).BackPack should work since you're using a character instead of player.
Report Abuse
SpazzMan502 is not online. SpazzMan502
Joined: 01 Aug 2013
Total Posts: 2397
03 Sep 2014 07:52 PM
I meant 'Players' , one of the categories next to Workspace, Lighting, StarterGUI, etc
Report Abuse
CLIMAXIMUS is not online. CLIMAXIMUS
Joined: 22 Jun 2012
Total Posts: 1738
03 Sep 2014 07:54 PM
A player is not a model, therefor you've made a mistake.
Give your script, please.
Report Abuse
SpazzMan502 is not online. SpazzMan502
Joined: 01 Aug 2013
Total Posts: 2397
03 Sep 2014 07:56 PM
Can someone clear it up more.
Here's the script I used

--

script.Parent.Touched:connect(function(hit)
hit.Parent.Parent.Character.Backpack.Cam.Disabled = false
wait(6)
hit.Parent.Parent.Character.Backpack.Cam.Disabled = true
end)

--

Report Abuse
SpazzMan502 is not online. SpazzMan502
Joined: 01 Aug 2013
Total Posts: 2397
03 Sep 2014 07:57 PM
The player is a model in workspace, If you press play solo and look in models there is Player1. It also appears in Players
Report Abuse
SpazzMan502 is not online. SpazzMan502
Joined: 01 Aug 2013
Total Posts: 2397
03 Sep 2014 07:59 PM
WAIT THATS NOT MY SCRIPT!
That was the one when I was testing things out



script.Parent.Touched:connect(function(hit)
hit.Parent.Backpack.Cam.Disabled = false
wait(6)
hit.Parent.Backpack.Cam.Disabled = true
end)



--thats the old one
Report Abuse
CLIMAXIMUS is not online. CLIMAXIMUS
Joined: 22 Jun 2012
Total Posts: 1738
03 Sep 2014 08:04 PM
--[[ time for you to learn how to script son ]]--
local sp = script.Parent -- script's parent
local parent = false -- pre made to make easier to get to + less doing
local player = false

function touched(hit)
player = false parent = false -- making it work
parent = hit.Parent -- hit's parent in workspace
if parent:findFirstChild("Humanoid") and GetPlayerFromCharacter(parent) then
player = GetPlayerFromCharacter(parent) -- states player
player.Backpack.Cam.Disabled = false -- enabled
wait(6) -- wait 6 seconds
player.Backpack.Cam.Disabled = true -- disabled
end

script.Parent.Touched:connect(touched) -- touched = function
Report Abuse
SpazzMan502 is not online. SpazzMan502
Joined: 01 Aug 2013
Total Posts: 2397
03 Sep 2014 08:39 PM
Didn't work
I don't want to give up on this script (it's a major part of my game)

Here's as much info as possible:

Working Disabled Camera LocalScript called Cam in StarterPack

Invisible block that when touched fires the script.

You might be misinterpreting it.

The section of explorer has Workspace, Lighting, Starterpack, Startergui, and so on. The Player1 with Backpack and PlayerGUI is in players section. The player Model is in workspace...
Report Abuse
SpazzMan502 is not online. SpazzMan502
Joined: 01 Aug 2013
Total Posts: 2397
03 Sep 2014 08:41 PM
Also, When i pasted in that script it underlined the last line saying
'end expected '
when I put end after it it went away, but that might be the cause of problem
Report Abuse
CLIMAXIMUS is not online. CLIMAXIMUS
Joined: 22 Jun 2012
Total Posts: 1738
03 Sep 2014 08:43 PM
good tip:
before making games test alot of stuff and become a good scripter
Report Abuse
CLIMAXIMUS is not online. CLIMAXIMUS
Joined: 22 Jun 2012
Total Posts: 1738
03 Sep 2014 08:43 PM
function touched(hit)
player = false parent = false -- making it work
parent = hit.Parent -- hit's parent in workspace
if parent:findFirstChild("Humanoid") and GetPlayerFromCharacter(parent) then
player = GetPlayerFromCharacter(parent) -- states player
player.Backpack.Cam.Disabled = false -- enabled
wait(6) -- wait 6 seconds
player.Backpack.Cam.Disabled = true -- disabled
end
end

script.Parent.Touched:connect(touched) -- touched = function
Report Abuse
SpazzMan502 is not online. SpazzMan502
Joined: 01 Aug 2013
Total Posts: 2397
03 Sep 2014 08:45 PM
Workspace.Part.Script:8: attempt to call global 'GetPlayerFromCharacter'
(a nil value)

got that after I tried again with another end after the first end
Report Abuse
SpazzMan502 is not online. SpazzMan502
Joined: 01 Aug 2013
Total Posts: 2397
03 Sep 2014 08:48 PM
Basically I test everything, and if navigating through scripts was easier I would already have a finished game.

It's saying GetPlayerFromCharacter is a nil value
Report Abuse
SpazzMan502 is not online. SpazzMan502
Joined: 01 Aug 2013
Total Posts: 2397
03 Sep 2014 08:49 PM
I'm overworking you, sorry... :I
Report Abuse
SpazzMan502 is not online. SpazzMan502
Joined: 01 Aug 2013
Total Posts: 2397
03 Sep 2014 08:52 PM
Lets try a different approach

In the game there is 1 person per server.

That means there would be one child in 'Players'

Report Abuse
Funse is not online. Funse
Joined: 11 Jun 2012
Total Posts: 7887
03 Sep 2014 09:10 PM
function touched(hit)
player = false parent = false -- making it work
parent = hit.Parent -- hit's parent in workspace
if parent:findFirstChild("Humanoid") and game.Players:GetPlayerFromCharacter(parent) then
player = GetPlayerFromCharacter(parent) -- states player
player.Backpack.Cam.Disabled = false -- enabled
wait(6) -- wait 6 seconds
player.Backpack.Cam.Disabled = true -- disabled
end
end
Report Abuse
SpazzMan502 is not online. SpazzMan502
Joined: 01 Aug 2013
Total Posts: 2397
03 Sep 2014 09:23 PM
^

You realize you just copied and pasted what above said, without the connecting statement...

Report Abuse
Funse is not online. Funse
Joined: 11 Jun 2012
Total Posts: 7887
03 Sep 2014 09:27 PM
You realized I didn't copied it, I fixed it.
Report Abuse
davisky2 is not online. davisky2
Joined: 04 Mar 2012
Total Posts: 4710
04 Sep 2014 12:25 AM
Spazz, you know you are doing it in solo mode, in solo mode some things are disabled, so i will give you a script that should work in solo and multiplayer...

db = 0
script.Parent.Touched:connect(hit)
if db == 0 then
db = 1
hum = hit.Parent:findFirstChild("Humanoid")
if hum ~= nil then
player = game.Players:findFirstChild(hum.Parent.Name)
if player ~= nil then
player.Backpack.Cam.Disabled = false
end
end
db = 0
end
end)
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