zeninja
|
  |
| Joined: 04 Feb 2009 |
| Total Posts: 96 |
|
|
| 11 May 2012 06:22 PM |
This script below is for capturing a spawn location and if the player is a certain color then a script will show saying which team captured the spawn. I have the script in the spawn location with the currentowner value. The value is set as white. No output shows when I step on the spawn location.
team = script.Parent owner = script.Parent.CurrentOwner.Value function onTouch(hit) local user = game.Players:GetPlayerFromCharacter(hit.Parent) if user ~= nil then if user.TeamColor == ("Bright Blue") and owner ~= ("Bright Blue") then local m = Instance.new("Message") m.Parent = game.Workspace m.Text = "CP3 has been taken by the Blues" owner = user.TeamColor team.TeamColor = user.TeamColor team.BrickColor = user.TeamColor wait(2) m:Remove() owner = user.TeamColor team.TeamColor = user.TeamColor team.BrickColor = user.TeamColor else if shirtC== ("Bright Red") and owner ~= ("Bright Red") then local m = Instance.new("Message") m.Parent = game.Workspace m.Text = "CP3 has been taken by the Reds" owner = user.TeamColor team.TeamColor = user.TeamColor team.BrickColor = user.TeamColor wait(2) m:Remove() end end end end
script.Parent.Touched:connect(onTouch)
|
|
|
| Report Abuse |
|
|
Lenimoy
|
  |
| Joined: 09 May 2012 |
| Total Posts: 8 |
|
|
| 11 May 2012 07:31 PM |
| I think you need an 'end' after that last line. See if that works. |
|
|
| Report Abuse |
|
|
Lenimoy
|
  |
| Joined: 09 May 2012 |
| Total Posts: 8 |
|
| |
|
zeninja
|
  |
| Joined: 04 Feb 2009 |
| Total Posts: 96 |
|
|
| 11 May 2012 09:12 PM |
| Someone who can script please help! |
|
|
| Report Abuse |
|
|
vat21s
|
  |
| Joined: 07 Jun 2010 |
| Total Posts: 2508 |
|
|
| 11 May 2012 09:16 PM |
CommandPosts={}
commandPosts=0 function getPosts(c) for i,v in pairs(c) do
if v:IsA("SpawnPoint") then v.Name="CP"+commandPosts commandPosts=commandPosts+1 v.OnTouched:connect( function(Player) if Player.TeamColor==v.Color then break else v.TeamColor=Player.TeamColor v.Color=Player.TeamColor Display(Player.Name..+" Has Just Captured Command Post "..v.Name; end end) end getPosts(c) end end
getPosts(game.Workspace)
//Very Experimental Haven't tested it |
|
|
| Report Abuse |
|
|
Xnite515
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 22763 |
|
|
| 11 May 2012 09:16 PM |
owner = user.TeamColor team.TeamColor = user.TeamColor team.BrickColor = user.TeamColor
Why is that on middle of m? |
|
|
| Report Abuse |
|
|
Xnite515
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 22763 |
|
| |
|
zeninja
|
  |
| Joined: 04 Feb 2009 |
| Total Posts: 96 |
|
|
| 12 May 2012 05:14 PM |
I tired your script Vat and it didn't work. I modified your script and here it is:
function Capture(hit) if hit.Parent:findFirstChild("Humanoid") ~= nil then name = hit.Parent Player = game.Players:GetPlayerFromCharacter(name) v = script.Parent if Player.TeamColor == v.TeamColor then end else v.TeamColor = Player.TeamColor v.BrickColor = Player.TeamColor v.Parent.BodyMaker.BrickColor = Player.TeamColor Display("Player.TeamColor has just captured CP3!") end end end end end script.Parent.Touched:connect(hit)
The script still does not work and there is an error. It says in output that eof' expected near 'end' I don't know what an eof is. |
|
|
| Report Abuse |
|
|
|
| 12 May 2012 06:17 PM |
function Capture(hit) if hit.Parent:findFirstChild("Humanoid") ~= nil then name = hit.Parent Player = game.Players:GetPlayerFromCharacter(name) v = script.Parent if Player.TeamColor == v.TeamColor then end else v.TeamColor = Player.TeamColor v.BrickColor = Player.TeamColor v.Parent.BodyMaker.BrickColor = Player.TeamColor Display("Player.TeamColor has just captured CP3!") end end end end end script.Parent.Touched:connect(hit)
^Change script.Parent.Touched:connect(hit) to script.Parent.Touched:connect(Capture) |
|
|
| Report Abuse |
|
|
zeninja
|
  |
| Joined: 04 Feb 2009 |
| Total Posts: 96 |
|
|
| 12 May 2012 09:40 PM |
| It still expects eof near end. |
|
|
| Report Abuse |
|
|
abaw7
|
  |
| Joined: 23 Oct 2009 |
| Total Posts: 745 |
|
| |
|
zeninja
|
  |
| Joined: 04 Feb 2009 |
| Total Posts: 96 |
|
| |
|
abaw7
|
  |
| Joined: 23 Oct 2009 |
| Total Posts: 745 |
|
|
| 12 May 2012 09:52 PM |
| Yes so try adding ends and removing ends |
|
|
| Report Abuse |
|
|
zeninja
|
  |
| Joined: 04 Feb 2009 |
| Total Posts: 96 |
|
|
| 12 May 2012 09:54 PM |
No error for the following script but, still doesn't work when I step on it.
function Capture(hit) if hit.Parent:findFirstChild("Humanoid") ~= nil then name = hit.Parent Player = game.Players:GetPlayerFromCharacter(name) v = script.Parent if Player.TeamColor == v.TeamColor then end else v.TeamColor = Player.TeamColor v.BrickColor = Player.TeamColor v.Parent.BodyMaker.BrickColor = Player.TeamColor local m = Instance.new("Message") m.Parent = game.Workspace m.Text = Player.TeamColor.."has taken CP3" wait(2) m:Remove() end end script.Parent.Touched:connect(Capture) |
|
|
| Report Abuse |
|
|