maxomega3
|
  |
| Joined: 11 Jun 2010 |
| Total Posts: 10668 |
|
|
| 22 Sep 2013 08:19 PM |
It's creepy. NO error messages whatsoever
local flag = script.Parent local base = script.Parent.Parent.Base
function OnTouch (base) local humanoid = hit.Parent:findFirstChild("Humanoid") if (hit.Parent:findFirstChild("Humanoid")~= nil) then return end if (game.Players:playerFromCharacter(hit.Parent)~= nil) then local thief = game.Players:playerFromCharacter(hit.Parent) flag.BrickColor = thief.TeamColor end end
while flag.BrickColor == BrickColor.new ('Deep orange') do game.Teams['Dauntless Empire'].Score = 1 wait (1) game.Teams['Dauntless Empire'].Score = 1 end while flag.BrickColor == BrickColor.new ('Really red') do game.Teams['Raiders'].Score = 1 wait (1) end I even tried print statements in every one, and none of them print! |
|
|
| Report Abuse |
|
|
|
| 22 Sep 2013 08:31 PM |
local flag = script.Parent local base = script.Parent.Parent.Base
function OnTouch (base) local humanoid = hit.Parent:findFirstChild("Humanoid") if (hit.Parent:findFirstChild("Humanoid")~= nil) then return end if (game.Players:playerFromCharacter(hit.Parent)~= nil) then local thief = game.Players:playerFromCharacter(hit.Parent) flag.BrickColor = thief.TeamColor end end
flag.Touched:connect(OnTouch)
while flag.BrickColor == BrickColor.new ('Deep orange') do game.Teams['Dauntless Empire'].Score = 1 wait (1) game.Teams['Dauntless Empire'].Score = 1 end
while flag.BrickColor == BrickColor.new ('Really red') do game.Teams['Raiders'].Score = 1 wait (1) end |
|
|
| Report Abuse |
|
|
maxomega3
|
  |
| Joined: 11 Jun 2010 |
| Total Posts: 10668 |
|
|
| 23 Sep 2013 04:37 PM |
| I feel like an idiot. Rookie mistake to forget a connection line. Thanks! |
|
|
| Report Abuse |
|
|
maxomega3
|
  |
| Joined: 11 Jun 2010 |
| Total Posts: 10668 |
|
|
| 25 Sep 2013 06:58 AM |
Added it, but now it doesn't know what hit is.
Why can I never properly defined hit? |
|
|
| Report Abuse |
|
|
LuaWeaver
|
  |
| Joined: 28 Jun 2013 |
| Total Posts: 213 |
|
|
| 25 Sep 2013 07:02 AM |
You have: function OnTouch(base) ...
"hit", as you refer to, is really just the parameter. Right now it's base. Try changing it to:
function onTouch(hit) ... |
|
|
| Report Abuse |
|
|
maxomega3
|
  |
| Joined: 11 Jun 2010 |
| Total Posts: 10668 |
|
|
| 26 Sep 2013 06:43 AM |
Well, that at least gave me a "Touch Interest" object in the Base, so we're getting somewhere, but still NO error lines:
local flag = script.Parent.Parent.Flag local base = script.Parent
function OnTouch (hit) local humanoid = hit.Parent:findFirstChild("Humanoid") if (hit.Parent:findFirstChild("Humanoid")~= nil) then return end if (game.Players:playerFromCharacter(hit.Parent)~= nil) then print 'Test1' local thief = game.Players:playerFromCharacter(hit.Parent) flag.BrickColor = thief.TeamColor end end
flag.Touched:connect (OnTouch)
local flag = script.Parent.Parent.Flag local base = script.Parent
while flag.BrickColor == BrickColor.new ('Deep orange') do print 'DE has flag!' game.Teams['Dauntless Empire'].Score = game.Teams['Dauntless Empire'].Score + 1 wait (1) end
local flag = script.Parent.Parent.Flag local base = script.Parent
while flag.BrickColor == BrickColor.new ('Really red') do print 'Raiders!' game.Teams['Raiders'].Score = game.Teams['Raiders'].Score + 1 wait (1) end Do I have to make this a local script, and link the source to the base? |
|
|
| Report Abuse |
|
|
maxomega3
|
  |
| Joined: 11 Jun 2010 |
| Total Posts: 10668 |
|
| |
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 30 Sep 2013 09:40 AM |
2 while loops. Obviously it's going to wait till the first one is done |
|
|
| Report Abuse |
|
|
maxomega3
|
  |
| Joined: 11 Jun 2010 |
| Total Posts: 10668 |
|
|
| 03 Oct 2013 06:47 AM |
| Nice! But I'm having trouble with the first Hit function. I'll modify it and separate the while loops. |
|
|
| Report Abuse |
|
|
maxomega3
|
  |
| Joined: 11 Jun 2010 |
| Total Posts: 10668 |
|
|
| 03 Oct 2013 07:11 AM |
This is the only part NOT working for me (I fixed everything else)
local flag = script.Parent.Parent.Flag local base = script.Parent
function OnTouch (hit) local humanoid = hit.Parent:findFirstChild("Humanoid") if (hit.Parent:findFirstChild("Humanoid")~= nil) then return end if (game.Players:playerFromCharacter(hit.Parent)~= nil) then print 'Test1' local thief = game.Players:playerFromCharacter(hit.Parent) flag.BrickColor = thief.TeamColor end end
local flag = script.Parent.Parent.Flag flag.Touched:connect (OnTouch)
I have a feeling my connection line is wrong |
|
|
| Report Abuse |
|
|
|
| 03 Oct 2013 07:13 AM |
LIne 8
print 'Test' I do not see your parentheses. |
|
|
| Report Abuse |
|
|
sam8985
|
  |
| Joined: 12 Nov 2011 |
| Total Posts: 582 |
|
|
| 03 Oct 2013 07:55 AM |
| You don't need parentheses when printing plain text. |
|
|
| Report Abuse |
|
|
|
| 03 Oct 2013 08:04 AM |
print 'Test' print "Test" print ('Test') print("Test")
All of these will work.
|
|
|
| Report Abuse |
|
|
maxomega3
|
  |
| Joined: 11 Jun 2010 |
| Total Posts: 10668 |
|
|
| 03 Oct 2013 06:38 PM |
Great. Knew that. Now that we've established that, can we move on? What is actually wrong? (Thanks for trying, Dragon) |
|
|
| Report Abuse |
|
|
|
| 03 Oct 2013 07:17 PM |
flag = script.Parent base = script.Parent.Parent.Base defendteam = ["Defenders"] raid = ["Raiders"] --DONT TOUCH BELOW-- t = game:GetService("Teams") plrs = game:GetService("Players")
currentowner = defendteam
function update() flag.BrickColor = t[currentowner].TeamColor end
function isonteam(plr, team) return plr.TeamColor == t[team].TeamColor end
base.Touched:connect(function(hit) local h = hit.Parent:FindFirstChild("Humanoid") if not h then return end if h.Health < 1 then return end local char = hit.Parent if char == workspace then return end local plr = plrs:GetPlayerFromCharacter(char) if not plr then return end if isonteam(plr, currentowner) then return end if isonteam(plr, raid) then currentowner = raid update() elseif isonteam(plr, defendteam) then currentowner = defendteam update() end end)
Spawn(function() while flag.BrickColor.Name == t[defendteam].TeamColor do t[defendteam].Score = 1 wait(1) t[defendteam].Score = 1 end end) Spawn(function() while flag.BrickColor.Name == t[raid].TeamColor do t[raid].Score = 1 wait(1) t[raid].Score = 1 end end) |
|
|
| Report Abuse |
|
|
maxomega3
|
  |
| Joined: 11 Jun 2010 |
| Total Posts: 10668 |
|
|
| 03 Oct 2013 07:38 PM |
Wholly shiz... Didn't realize it was that complicated. I'll try it. |
|
|
| Report Abuse |
|
|