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 » Scripters
Home Search
 

Re: Whats wrong with this script ?

Previous Thread :: Next Thread 
PresidentRobux is not online. PresidentRobux
Joined: 22 Nov 2015
Total Posts: 481
30 Apr 2016 10:29 AM
function onTouch()
script.Parent.Touched
if game.Players.LocalPlayer.TeamColor = game.Teams.Cops.TeamColor then script.Parent.Transparency = 0.5
end
Report Abuse
Salinas23 is not online. Salinas23
Joined: 28 Dec 2008
Total Posts: 37142
30 Apr 2016 10:31 AM
everything




local player = game.Players.LocalPlayer
local brick = script.Parent
local debounce = false

function onTouch()
if not debounce then
debounce == true
if player.TeamColor == game:GetService("Teams").Cops.TeamColor then
brick.Transparency = 0.5
end
wait(1)
debounce = false
brick.Touched:connect(onTouch)
Report Abuse
ExtremeBuilder15 is not online. ExtremeBuilder15
Joined: 01 May 2012
Total Posts: 3176
30 Apr 2016 10:32 AM
I assume you're trying to use a .Touched event

function onTouch(hit)
if hit.Parent:FindFirstChild("Torso") then
player = hit.Parent:GetPlayerFromCharacter()
if player.TeamColor == game.Teams.Cops.TeamColor then
script.Parent.Transparency = 0.5
end
end
end

script.Parent.Touched:connect(onTouch)

I think this is what you're going for.
Report Abuse
ExtremeBuilder15 is not online. ExtremeBuilder15
Joined: 01 May 2012
Total Posts: 3176
30 Apr 2016 10:33 AM
@Sal local player probably won't work since this script is in a part.
Report Abuse
Salinas23 is not online. Salinas23
Joined: 28 Dec 2008
Total Posts: 37142
30 Apr 2016 10:34 AM
I totally didnt forget to pass the hit argument






local brick = script.Parent
local debounce = false

brick.Touched:connect(function(hit)
if not debounce then
debounce == true
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
if player.TeamColor == game:GetService("Teams").Cops.TeamColor then
brick.Transparency = 0.5
end
end
wait(1)
debounce = false
end
end)

Report Abuse
Vortius is not online. Vortius
Joined: 05 Apr 2014
Total Posts: 861
30 Apr 2016 10:35 AM
everything... everything is wrong...
Report Abuse
lululukas is not online. lululukas
Joined: 23 Aug 2010
Total Posts: 1043
30 Apr 2016 10:37 AM
@OP I don't even know where to begin.

@Salinas you did == instead of = on the debounce.
Report Abuse
Salinas23 is not online. Salinas23
Joined: 28 Dec 2008
Total Posts: 37142
30 Apr 2016 10:37 AM
I've been confusing a lot recently between = and ==

but you get the point and thats a vague tiny mistake
Report Abuse
PresidentRobux is not online. PresidentRobux
Joined: 22 Nov 2015
Total Posts: 481
30 Apr 2016 10:38 AM
Still not working mates.
Report Abuse
lululukas is not online. lululukas
Joined: 23 Aug 2010
Total Posts: 1043
30 Apr 2016 10:39 AM
I do, but obviously he wouldn't
Report Abuse
ExtremeBuilder15 is not online. ExtremeBuilder15
Joined: 01 May 2012
Total Posts: 3176
30 Apr 2016 10:41 AM
@Sal I just think of = being equals and == as is equal to.












It works for me :P
Report Abuse
Marienus is not online. Marienus
Joined: 02 Jul 2012
Total Posts: 118
30 Apr 2016 10:41 AM
function onTouch(hit)
if script.Parent:FindFirstChild("Humanoid") then
if game.Players[hit.Parent.Name].TeamColor == game.Teams.Cops.TeamColor then script.Parent.Transparency = 0.5
end
end
end

script.Parent.Touched:connect(onTouch)
Report Abuse
Marienus is not online. Marienus
Joined: 02 Jul 2012
Total Posts: 118
30 Apr 2016 10:42 AM
I made a mistake in my previous reply

function onTouch(hit)
if hit.Parent:FindFirstChild("Humanoid") then
if game.Players[hit.Parent.Name].TeamColor == game.Teams.Cops.TeamColor then script.Parent.Transparency = 0.5
end
end
end

script.Parent.Touched:connect(onTouch)
Report Abuse
Salinas23 is not online. Salinas23
Joined: 28 Dec 2008
Total Posts: 37142
30 Apr 2016 10:45 AM
thats it

local brick = script.Parent
local debounce = false

brick.Touched:connect(function(hit)
if not debounce then
debounce = true
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
if player.TeamColor == game:GetService("Teams").Cops.TeamColor then
brick.Transparency = 0.5
end
end
wait(1)
debounce = false
end
end)
Report Abuse
PresidentRobux is not online. PresidentRobux
Joined: 22 Nov 2015
Total Posts: 481
30 Apr 2016 10:56 AM
still not working
Report Abuse
Salinas23 is not online. Salinas23
Joined: 28 Dec 2008
Total Posts: 37142
30 Apr 2016 10:58 AM
good luck then
Report Abuse
Silicti is not online. Silicti
Joined: 07 Nov 2012
Total Posts: 8242
30 Apr 2016 10:58 AM
did you put the script in the part
Report Abuse
PresidentRobux is not online. PresidentRobux
Joined: 22 Nov 2015
Total Posts: 481
30 Apr 2016 10:59 AM
I did
Report Abuse
Silicti is not online. Silicti
Joined: 07 Nov 2012
Total Posts: 8242
30 Apr 2016 11:02 AM
can you add me to the team create, and give me the link
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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