generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Please Help fix this script

Previous Thread :: Next Thread 
zeninja is not online. 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 is not online. 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 is not online. Lenimoy
Joined: 09 May 2012
Total Posts: 8
11 May 2012 07:40 PM
Nvm, that did'nt help.
Report Abuse
zeninja is not online. zeninja
Joined: 04 Feb 2009
Total Posts: 96
11 May 2012 09:12 PM
Someone who can script please help!
Report Abuse
vat21s is not online. 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 is not online. 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 is not online. Xnite515
Joined: 18 Feb 2011
Total Posts: 22763
11 May 2012 09:18 PM
Vat, no connect?
Report Abuse
zeninja is not online. 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
Shad0wH4wk is not online. Shad0wH4wk
Joined: 17 Dec 2010
Total Posts: 94
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 is not online. zeninja
Joined: 04 Feb 2009
Total Posts: 96
12 May 2012 09:40 PM
It still expects eof near end.
Report Abuse
abaw7 is not online. abaw7
Joined: 23 Oct 2009
Total Posts: 745
12 May 2012 09:42 PM
End Of Function
Report Abuse
zeninja is not online. zeninja
Joined: 04 Feb 2009
Total Posts: 96
12 May 2012 09:51 PM
doesn't the ends do that?
Report Abuse
abaw7 is not online. 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 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image