|
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 |
|
CurosityJoin Date: 2010-08-18 Post Count: 1085 |
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 |
|
|
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. |
|
|
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 |
|
CurosityJoin Date: 2010-08-18 Post Count: 1085 |
Master, why don't you chill? I was just trying to help :'c |
|
ClirexJoin Date: 2012-06-22 Post Count: 2721 |
Simply because "Backpack" is a part of player, not character.
GetPlayerFromCharacter(player).BackPack should work since you're using a character instead of player. |
|
|
I meant 'Players' , one of the categories next to Workspace, Lighting, StarterGUI, etc |
|
ClirexJoin Date: 2012-06-22 Post Count: 2721 |
A player is not a model, therefor you've made a mistake.
Give your script, please. |
|
|
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)
--
|
|
|
The player is a model in workspace, If you press play solo and look in models there is Player1. It also appears in Players |
|
|
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 |
|
ClirexJoin Date: 2012-06-22 Post Count: 2721 |
--[[ 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 |
|
|
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... |
|
|
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 |
|
ClirexJoin Date: 2012-06-22 Post Count: 2721 |
good tip:
before making games test alot of stuff and become a good scripter |
|
ClirexJoin Date: 2012-06-22 Post Count: 2721 |
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 |
|
|
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 |
|
|
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
|
|
|
I'm overworking you, sorry... :I |
|
|
Lets try a different approach
In the game there is 1 person per server.
That means there would be one child in 'Players'
|
|
FunseJoin Date: 2012-06-11 Post Count: 7887 |
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
|
|
|
^
You realize you just copied and pasted what above said, without the connecting statement...
|
|
FunseJoin Date: 2012-06-11 Post Count: 7887 |
You realized I didn't copied it, I fixed it. |
|
DankviskyJoin Date: 2012-03-04 Post Count: 5430 |
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) |
|