|
| 27 Jul 2016 03:16 PM |
Why does this script give me an error in Output saying "Humanoid is not a valid member of Part"?
local model = script.Parent.Parent local screen = model.screen local add = model.Add
function addName(hit) if hit.Humanoid ~= nil then local n = Instance.new("CFrameValue", add.PlayersInLine) n.Namee = hit.Name end end
add.Touched:connect(addName)
|
|
|
| Report Abuse |
|
|
|
| 27 Jul 2016 03:18 PM |
function addName(hit) if hit.Parent:FindFirstChild("Humanoid") ~= nil then local n = Instance.new("CFrameValue", add.PlayersInLine) n.Namee = hit.Parent.Name end end
( ͡• ◡ ͡•) -=[ RAP: 346,681 || DurstAuric; the narb of ROBLOX ]=- ( ͡• ◡ ͡•) |
|
|
| Report Abuse |
|
|
|
| 27 Jul 2016 03:29 PM |
Okay, so this works, but it adds many times, I know there's a way I can make it like only do it once but I don't know how, please help.
local model = script.Parent.Parent local screen = model.screen local add = model.Add local remove = model.Remove
function addName(hit) if hit.Parent:FindFirstChild("Humanoid") ~= nil then local n = Instance.new("CFrameValue", add.PlayersInLine) n.Name = hit.Parent.Name end end
function removeName(hit) --stuff end
add.Touched:connect(addName) remove.Touched:connect(removeName)
|
|
|
| Report Abuse |
|
|
|
| 27 Jul 2016 03:40 PM |
You need a debounce.
local model = script.Parent.Parent local screen = model.screen local add = model.Add local remove = model.Remove local debounce = false
function addName(hit) if hit.Parent:FindFirstChild("Humanoid") ~= nil and not debounce then debounce = true local n = Instance.new("CFrameValue", add.PlayersInLine) n.Name = hit.Parent.Name debounce = false end end
function removeName(hit) --stuff end
add.Touched:connect(addName) remove.Touched:connect(removeName)
( ͡• ◡ ͡•) -=[ RAP: 347,122 || DurstAuric; the narb of ROBLOX ]=- ( ͡• ◡ ͡•) |
|
|
| Report Abuse |
|
|
|
| 27 Jul 2016 03:46 PM |
Doesn't work, still spams me with values, nothing in output.
|
|
|
| Report Abuse |
|
|
|
| 27 Jul 2016 04:29 PM |
local model = script.Parent.Parent local screen = model.screen local add = model.Add local remove = model.Remove
function addName(hit) if hit.Parent:FindFirstChild("Humanoid") ~= nil then -- Add an "and not" here to see if the player doesn't have a "CFrameValue". local n = Instance.new("CFrameValue", add.PlayersInLine) n.Name = hit.Parent.Name end end
function removeName(hit) --stuff end
add.Touched:connect(addName) remove.Touched:connect(removeName)
( ͡• ◡ ͡•) -=[ RAP: 348,476 || DurstAuric; the narb of ROBLOX ]=- ( ͡• ◡ ͡•) |
|
|
| Report Abuse |
|
|
|
| 27 Jul 2016 07:12 PM |
I'm very confused what you mean "Add an and not to see if the player doesn't have a "CFrameValue"
|
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 27 Jul 2016 07:47 PM |
"if hit.Humanoid ~= nil"
Hit will return the part hit.
None of the parts in any character has a humanoid inside it. it only has a humanoid inside its parent
hit.Parent:FindFirstChild("Humanoid") will see if the hit object has a humanoid in its parent, if not will return nil |
|
|
| Report Abuse |
|
|
|
| 27 Jul 2016 07:58 PM |
Durst already corrected that, what doesn't work is;
local model = script.Parent.Parent local screen = model.screen local add = model.Add local remove = model.Remove
function addName(hit) if hit.Parent:FindFirstChild("Humanoid") ~= nil then -- Add an "and not" here to see if the player doesn't have a "CFrameValue". local n = Instance.new("CFrameValue", add.PlayersInLine) n.Name = hit.Parent.Name end end
function removeName(hit) --stuff end
add.Touched:connect(addName) remove.Touched:connect(removeName)
|
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 28 Jul 2016 12:38 AM |
| cough cough cough cough cough |
|
|
| Report Abuse |
|
|
|
| 28 Jul 2016 12:41 AM |
--here try this: local model = script.Parent.Parent local screen = model.screen local add = model.Add
function addName(hit) if hit.Parent:FindFirstChild("Humanoid") then if hit.Parent.Humanoid.ClassName == "Humanoid" then if hit.Humanoid ~= nil then --local n = Instance.new("CFrameValue", add.PlayersInLine) --n.Namee = hit.Name end end end end
add.Touched:connect(addName) |
|
|
| Report Abuse |
|
|
|
| 28 Jul 2016 12:42 AM |
wait "2" --here try this: local model = script.Parent.Parent local screen = model.screen local add = model.Add
function addName(hit) if hit.Parent:FindFirstChild("Humanoid") then if hit.Parent.Humanoid.ClassName == "Humanoid" then local n = Instance.new("CFrameValue", add.PlayersInLine) n.Namee = hit.Name end end end
add.Touched:connect(addName) |
|
|
| Report Abuse |
|
|
|
| 28 Jul 2016 12:47 AM |
| I'm not real sure what you think adding that would do, but I think I figured out how I can do it, I'm on mobile and don't want to forget so don't mind my note to self; STOP BEING AN IDIOT, CHECK IF THEY ALREADY HAVE A VALUE |
|
|
| Report Abuse |
|
|
| |
|
|
| 28 Jul 2016 12:51 AM |
--here try this: local model = script.Parent.Parent local screen = model.screen local add = model.Add
function addName(hit) if hit.Parent:FindFirstChild("Humanoid") and not add.PlayerInLine:FindFirstChild(add) then if hit.Parent.Humanoid.ClassName == "Humanoid" then local n = Instance.new("CFrameValue", add.PlayersInLine) n.Namee = hit.Name end end end
add.Touched:connect(addName) |
|
|
| Report Abuse |
|
|
|
| 28 Jul 2016 12:55 AM |
--[[try this:]]wait "2" local model = script.Parent.Parent local screen = model.screen local add = model.Add function addName(hit) if hit.Parent:FindFirstChild("Humanoid") and not add.PlayerInLine:FindFirstChild(hit.Parent.Name) then if hit.Parent.Humanoid.ClassName == "Humanoid" then local n = Instance.new("CFrameValue", add.PlayersInLine) n.Namee = hit.Parent.Name end end end add.Touched:connect(addName) |
|
|
| Report Abuse |
|
|
|
| 28 Jul 2016 12:55 AM |
--[[try this:]]wait "2" local model = script.Parent.Parent local screen = model.screen local add = model.Add function addName(hit) if hit.Parent:FindFirstChild("Humanoid") and not add.PlayerInLine:FindFirstChild(hit.Parent.Name) then if hit.Parent.Humanoid.ClassName == "Humanoid" then local n = Instance.new("CFrameValue", add.PlayersInLine) n.Name = hit.Parent.Name end end end add.Touched:connect(addName) |
|
|
| Report Abuse |
|
|