Bananacb
|
  |
| Joined: 13 Jun 2008 |
| Total Posts: 5188 |
|
|
| 12 Apr 2015 08:58 PM |
Errors I can't solve in the script... W001: Unknown global 'hit' W001: Unknown global 'player' W001: Unknown global 'Backpack' ----------------------------------------------------------------------------------------
--Touch function: brick = script.Parent
--Adding parents won't help you unless you moved the script... brick.Touched:connect(function(hit) if hit.Parent then--Just make sure hit has a parent in case someone has a bow or gun or like touches and leaves instantly so it won't break if game.Players:FindFirstChild(hit.Parent.Name) then if game.Players.Backpack:FindFirstChild("Hockey Stick") then print'A player touched the brick!' local player = game.Players:FindFirstChild(hit.Parent.Name)--Makes the player a local variable if player.TeamColor == BrickColor.new'Bright blue' or Backpack.HockeyStick.blade.BrickColor == BrickColor.new("Bright blue") then--checks if player is on the blue team print(player.Name..' is on the blue team.') if script.Parent.Parent.Control.Value == 1 then script.Parent.Parent.TeamTwoAssists.Value = "?" script.Parent.Parent.TeamTwoAssist.Value = "?" script.Parent.Parent.TeamTwoGoal.Value = hit.Parent.Parent.Name end end end end end end) if script.Parent.Parent.Control.Value == 2 and hit.Parent.Parent.Name == script.Parent.Parent.TeamTwoGoal.Value then print'Bluehi' end
if hit.Parent.Name ~= script.Parent.Parent.TeamTwoGoal.Value then script.Parent.Parent.TeamTwoAssists.Value = script.Parent.Parent.TeamTwoAssist.Value script.Parent.Parent.TeamTwoAssist.Value = script.Parent.Parent.TeamTwoGoal.Value script.Parent.Parent.TeamTwoGoal.Value = hit.Parent.Name script.Parent.Parent.Control.Value = 2 elseif player.TeamColor == BrickColor.new'Bright red' or Backpack.HockeyStick.blade.BrickColor == BrickColor.new("Bright red") then --checks if player is on the red team print(player.Name..' is on the red team.') if script.Parent.Parent.Control.Value == 1 then script.Parent.Parent.TeamTwoAssists.Value = "?" script.Parent.Parent.TeamTwoAssist.Value = "?" script.Parent.Parent.TeamTwoGoal.Value = hit.Parent.Parent.Name end end if hit.Parent.Name ~= script.Parent.Parent.TeamOneGoal.Value then script.Parent.Parent.TeamOneAssists.Value = script.Parent.Parent.TeamOneAssist.Value script.Parent.Parent.Parent.TeamOneAssist.Value = script.Parent.Parent.TeamOneGoal.Value script.Parent.Parent.TeamOneGoal.Value = hit.Parent.Name end
|
|
|
| Report Abuse |
|
|
amanda
|
  |
| Joined: 21 Nov 2006 |
| Total Posts: 5925 |
|
|
| 12 Apr 2015 09:00 PM |
you can't use hit and player outside of your function
and you just made up 'BackPack'. |
|
|
| Report Abuse |
|
|
Bananacb
|
  |
| Joined: 13 Jun 2008 |
| Total Posts: 5188 |
|
| |
|
Bananacb
|
  |
| Joined: 13 Jun 2008 |
| Total Posts: 5188 |
|
|
| 12 Apr 2015 09:10 PM |
What about... Error (24,5) Expected') '(to close'('at line 5) got if' =======================================================================================
--Touch function: brick = script.Parent
--Adding parents won't help you unless you moved the script... brick.Touched:connect(function(hit) if hit.Parent then--Just make sure hit has a parent in case someone has a bow or gun or like touches and leaves instantly so it won't break if game.Players:FindFirstChild(hit.Parent.Name) then if game.Players.Backpack:FindFirstChild("Hockey Stick") then print'A player touched the brick!' local player = game.Players:FindFirstChild(hit.Parent.Name)--Makes the player a local variable if player.TeamColor == BrickColor.new'Bright blue' or Backpack.HockeyStick.blade.BrickColor == BrickColor.new("Bright blue") then--checks if player is on the blue team print(player.Name..' is on the blue team.') if script.Parent.Parent.Control.Value == 1 then script.Parent.Parent.TeamTwoAssists.Value = "?" script.Parent.Parent.TeamTwoAssist.Value = "?" script.Parent.Parent.TeamTwoGoal.Value = hit.Parent.Parent.Name end end end end end end if script.Parent.Parent.Control.Value == 2 and hit.Parent.Parent.Name == script.Parent.Parent.TeamTwoGoal.Value then print'Bluehi' end
if hit.Parent.Name ~= script.Parent.Parent.TeamTwoGoal.Value then script.Parent.Parent.TeamTwoAssists.Value = script.Parent.Parent.TeamTwoAssist.Value script.Parent.Parent.TeamTwoAssist.Value = script.Parent.Parent.TeamTwoGoal.Value script.Parent.Parent.TeamTwoGoal.Value = hit.Parent.Name script.Parent.Parent.Control.Value = 2 elseif player.TeamColor == BrickColor.new'Bright red' or Backpack.HockeyStick.blade.BrickColor == BrickColor.new("Bright red") then --checks if player is on the red team print(player.Name..' is on the red team.') if script.Parent.Parent.Control.Value == 1 then script.Parent.Parent.TeamTwoAssists.Value = "?" script.Parent.Parent.TeamTwoAssist.Value = "?" script.Parent.Parent.TeamTwoGoal.Value = hit.Parent.Parent.Name end end if hit.Parent.Name ~= script.Parent.Parent.TeamOneGoal.Value then script.Parent.Parent.TeamOneAssists.Value = script.Parent.Parent.TeamOneAssist.Value script.Parent.Parent.Parent.TeamOneAssist.Value = script.Parent.Parent.TeamOneGoal.Value script.Parent.Parent.TeamOneGoal.Value = hit.Parent.Name end)
|
|
|
| Report Abuse |
|
|
|
| 16 Jun 2017 02:34 PM |
I usually define what it is,
For example:
If my Objects are Named something different like a TestFrame (Originally a Frame) then i would see a blue underlined line underneath the named Object.
My solution would be doing this:
Frame = script.Parent.Parent.TestFrame
That would then define what Frame your talking about..
Hope that helps..
Regards,
Freezesore |
|
|
| Report Abuse |
|
|
|
| 16 Jun 2017 07:06 PM |
| you didnt end the function on line 5 with an end) |
|
|
| Report Abuse |
|
|
|
| 16 Jun 2017 07:08 PM |
In behalf of the OP: Thanks, Freeze! You just saved this two-year overdue project and kept him from getting fired as a result!
|
|
|
| Report Abuse |
|
|
amanda
|
  |
| Joined: 21 Nov 2006 |
| Total Posts: 5925 |
|
| |
|
|
| 30 Jul 2017 11:55 AM |
| Not scripted in quite a while I don't know if what i have posted is correct :3 |
|
|
| Report Abuse |
|
|
|
| 30 Jul 2017 12:38 PM |
local variables can only be accessed from that code block, remove the local OR u can do this code
-- local string1="I am a string" local function Print() do print(string1) end end Print() |
|
|
| Report Abuse |
|
|
| |
|
|
| 31 Aug 2017 04:57 PM |
Why are you continuing to bump old threads?
|
|
|
| Report Abuse |
|
|