|
| 12 Sep 2015 10:38 PM |
everytime i try to change a script it says cant index a nil value ! script : brick = script.Parent inArea = false redBrick = Instance.new("Part", workspace) redBrick.CanCollide = false redBrick.Transparency = 1 redBrick.Position = Vector3.new(-193, 2.5, 9) redBrick.BrickColor = BrickColor.new(21) redBrick.Size = Vector3.new(4, 1, 6) redBrick.Anchored = true
function appearBrick() redBrick.Transparency = 0 redBrick.CanCollide =true end
function dissapearBrick() redBrick.Transparency = 1 redBrick.CanCollide =false end
brick.Touched:connect(function(hit) inArea = true print("In Area") human = hit.Parent:FindFirstChild("Humanoid") local char = game.Players:GetPlayerFromCharacter(human) if human then human.Parent.area=1 print("inside = true") print("Human") appearBrick() end end)
brick.TouchEnded:connect(function() human.Parent.area=0 print("inside = false") inArea=false print("Not In Area") dissapearBrick() end)
----------------- Why does this happen???? |
|
|
| Report Abuse |
|
|
| |
|
| |
|
| |
|
|
| 12 Sep 2015 11:35 PM |
| Is this the full script? If not, then paste the rest |
|
|
| Report Abuse |
|
|
|
| 12 Sep 2015 11:46 PM |
full script(only added a intvalue when a player join to show if hes in the area or not) line 35: human.Parent.area=0 |
|
|
| Report Abuse |
|
|
|
| 12 Sep 2015 11:47 PM |
don't u mean
human.Parent.area.Value = 0
if this is an IntVzlue? |
|
|
| Report Abuse |
|
|
|
| 13 Sep 2015 12:00 AM |
okay fixed that then after it says : 00:59:35.503 - area is not a valid member of Model 00:59:35.503 - Script 'Workspace.ProxBox.Script', Line 27 00:59:35.503 - Stack End line 27 : human.Parent.area.Value=1
|
|
|
| Report Abuse |
|
|
|
| 13 Sep 2015 12:02 AM |
| Where is the IntVzlue located |
|
|
| Report Abuse |
|
|
|
| 13 Sep 2015 12:05 AM |
the intvalue is located exactly at : game.Players.Player.area -- area is IntValue |
|
|
| Report Abuse |
|
|
|
| 13 Sep 2015 12:10 AM |
| Then why isn't it a valid member of model. Show the snippet of code where it's erroring |
|
|
| Report Abuse |
|
|
|
| 13 Sep 2015 12:11 AM |
u want me to show which code ._. |
|
|
| Report Abuse |
|
|
|
| 13 Sep 2015 12:12 AM |
I mean the leaderstats script looks fine:
-- Made by supermisstruth aka trainsis game.Players.PlayerAdded:connect(function (player) local stats = Instance.new("IntValue", player) stats.Name = "leaderstats" local area = Instance.new("IntValue", player) area.Name = "area" area.Value = 0 local point = Instance.new("IntValue", stats) point.Value = 150 point.Name = "Robux" end)
|
|
|
| Report Abuse |
|
|
| |
|
|
| 13 Sep 2015 12:27 AM |
| human.Parent.leaderstats.area.Value = 0 |
|
|
| Report Abuse |
|
|
Link5659
|
  |
| Joined: 04 Jun 2012 |
| Total Posts: 4525 |
|
|
| 13 Sep 2015 12:27 AM |
I have no idea right now ive had about 6 hours of sleep in 32 hours awake but try fixing this for starters
redBrick = Instance.new("Part", workspace) --this :3 |
|
|
| Report Abuse |
|
|
ShungTzu
|
  |
| Joined: 14 Jun 2014 |
| Total Posts: 959 |
|
|
| 13 Sep 2015 12:38 AM |
" Why does this happen???? "
Because GetPlayerFromCharacter returns a player in game.Players, only if you pass a player's character in workspace to it, and the parent of humanoid is a character, but you're passing a Humanoid to GetPlayerFromCharacter and looking in a character for area(which is in a player).
Replace this
brick.Touched:connect(function(hit) inArea = true print("In Area") human = hit.Parent:FindFirstChild("Humanoid") local char = game.Players:GetPlayerFromCharacter(human) if human then human.Parent.area=1 print("inside = true") print("Human") appearBrick() end end)
with this
brick.Touched:connect(function(hit) inArea = true print("In Area") local char=hit.Parent local human = char:FindFirstChild("Humanoid") local player= game.Players:GetPlayerFromCharacter(char) if human and player then player.Parent.area=1 print("inside = true") print("Human") appearBrick() end end) . I hope you pay attention to the difference. |
|
|
| Report Abuse |
|
|
ShungTzu
|
  |
| Joined: 14 Jun 2014 |
| Total Posts: 959 |
|
|
| 13 Sep 2015 12:42 AM |
Sorry, player.area=1 , not player.Parent.area=1 . |
|
|
| Report Abuse |
|
|
|
| 13 Sep 2015 12:53 AM |
humm.. 01:52:48.849 - Workspace.ProxBox.Script:36: attempt to index global 'player' (a nil value) script: brick = script.Parent inArea = false redBrick = Instance.new("Part", workspace) redBrick.CanCollide = false redBrick.Transparency = 1 redBrick.Position = Vector3.new(-193, 2.5, 9) redBrick.BrickColor = BrickColor.new(21) redBrick.Size = Vector3.new(4, 1, 6) redBrick.Anchored = true
function appearBrick() redBrick.Transparency = 0 redBrick.CanCollide =true end
function dissapearBrick() redBrick.Transparency = 1 redBrick.CanCollide =false end
brick.Touched:connect(function(hit) inArea = true print("In Area") local char=hit.Parent local human = char:FindFirstChild("Humanoid") player= game.Players:GetPlayerFromCharacter(char) if human and player then player.area.Value=1 print("inside = true") print("Human") appearBrick() end end)
brick.TouchEnded:connect(function() player.area.Value=0 print("inside = false") inArea=false print("Not In Area") dissapearBrick() end) line 36: player.area.Value=0
|
|
|
| Report Abuse |
|
|
| |
|
ShungTzu
|
  |
| Joined: 14 Jun 2014 |
| Total Posts: 959 |
|
|
| 13 Sep 2015 01:24 PM |
Something other than a player's Character is touching and then firing TouchEnded.
local char=hit.Parent local human = char:FindFirstChild("Humanoid") local player= game.Players:GetPlayerFromCharacter(char)--made "player" local to this function if human and player then player.area.Value=1 print("inside = true") print("Human") appearBrick() end end)
brick.TouchEnded:connect(function(hit)--get the part so you can do something to a player if the thing that stopped touching is part of a player's Character local char=hit.Parent local human = char:FindFirstChild("Humanoid") local player= game.Players:GetPlayerFromCharacter(char) if human and player then player.area.Value=0 print("inside = false") inArea=false print("Not In Area") dissapearBrick() end end) |
|
|
| Report Abuse |
|
|
|
| 13 Sep 2015 02:39 PM |
okay now my script work :) but now i made a guy that if the area value == 1 then it will show up and if its not equal to 1 it will dissapear and the script is not working ._. why?? script : local player = game.Players.LocalPlayer local shop = player.PlayerGui:WaitForChild("ShopGUI").MainGui
script.Parent.MouseButton1Click:connect(function () shop.Visible = not shop.Visible end)
if(player.area.Value==0) then shop.Visible = false player.PlayerGui:WaitForChild("Buttons").Frame.Visible = false print("Invisible") end
if(player.area.Value==1)then -- when in the area it will show up the Gui shop.Visible = true player.PlayerGui:WaitForChild("Buttons").Frame.Visible = true shop.Visible = not shop.Visible print("-------") print("Visible") print("-------") end |
|
|
| Report Abuse |
|
|
| |
|
| |
|
Link5659
|
  |
| Joined: 04 Jun 2012 |
| Total Posts: 4525 |
|
|
| 13 Sep 2015 04:35 PM |
if(player.area.Value==0) then shop.Visible = false player.PlayerGui:WaitForChild("Buttons").Frame.Visible = false print("Invisible") elseif(player.area.Value==1)then -- when in the area it will show up the Gui shop.Visible = true player.PlayerGui:WaitForChild("Buttons").Frame.Visible = true shop.Visible = not shop.Visible print("-------") print("Visible") print("-------") end --try this no idea if it will work :/ |
|
|
| Report Abuse |
|
|