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
 

TouchEnded ain't working

Previous Thread :: Next Thread 
Nicollye7074 is not online. Nicollye7074
Joined: 15 Feb 2014
Total Posts: 198
22 Sep 2017 12:44 AM
playerName = nil
script.Parent.Touched:connect(function(hit)
if playerName == nil then
playerName = hit.Parent.Name
print(playerName)
script.Parent.BrickColor = BrickColor.new("Navy blue")
end
end)

script.Parent.TouchEnded:connect(function(hit)
print(playerName)
script.Parent.BrickColor = BrickColor.new("Really red")
end
end)


This is a script I made to help out my friend. He is making a duel sword fighting game and basically this script changes the brickColor to Navy Blue when touched and when you get away from the brick, it turns back to Really red. The playerName is a variable that I used to register the names of the player that touch it so I can send them to the duel arena.
Please fix it someone. The entire touchEnded function isn't working
Report Abuse
Em_ily is not online. Em_ily
Joined: 21 Jan 2014
Total Posts: 1708
22 Sep 2017 03:24 AM
Use a StringValue, playerName.Value . . .
Report Abuse
Em_ily is not online. Em_ily
Joined: 21 Jan 2014
Total Posts: 1708
22 Sep 2017 03:28 AM
script.Parent.Touched:connect(function(hit)
if hit then
local playerName = hit:FindFirstChild('Parent').Name
print(playerName)
script.Parent.BrickColor = BrickColor.new('Navy blue')
end
end)

script.Parent.TouchEnded:connect(function(hit)
local playerName = hit:FindFirstChild('Parent').Name
print(playerName)
script.Parent.BrickColor = BrickColor.new('Really red')
end
end)

-- Should work?
Report Abuse
Em_ily is not online. Em_ily
Joined: 21 Jan 2014
Total Posts: 1708
22 Sep 2017 03:32 AM
Also you don't need their name, you could just do:

for i,v in pairs(game.Players:GetPlayers())
v.Character.Humanoid:MoveTo(game.workspace.Part.Position)
end

Inside of the brick...
Report Abuse
gohan31865 is not online. gohan31865
Joined: 30 Jan 2011
Total Posts: 895
22 Sep 2017 05:54 AM
:Connect not :connect


#code error("you're*")
Report Abuse
ISeeYourPost is not online. ISeeYourPost
Joined: 10 Jun 2013
Total Posts: 1815
22 Sep 2017 05:58 AM
you're a :weeb:ifier too?
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