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 » Game Design
Home Search
 

Re: Issue with a door opening script based on team

Previous Thread :: Next Thread 
TheBenSquare is not online. TheBenSquare
Joined: 13 Dec 2009
Total Posts: 13604
19 Dec 2014 07:45 PM
I made a script that is supposed to open a door when someone touches it if they're on a specific team. I matched the requirements and I tested it but it didn't work. Here's the script.

door = script.Parent
door.Touched:connect(function(toucher)
toucher.Parent.Humanoid:GetPlayerFromCharacter(_G.plyr)
if _G.plyr.TeamColor == game.Teams.Hostiles.TeamColor
then
door.Transparency = 0.5
door.CanCollide = false
wait(3)
door.Transparency = 0
door.CanCollide = true
end
end)

The only thing that the server-side output said was that Touched is not a valid member of Model. How can I fix this?



A true rock is not a rock silly goose.
Report Abuse
SMS1337 is not online. SMS1337
Joined: 19 Feb 2014
Total Posts: 10504
19 Dec 2014 07:47 PM
put the script in the part, not the model


"Eat greens everyday!" - Snoop Catt
Report Abuse
TheBenSquare is not online. TheBenSquare
Joined: 13 Dec 2009
Total Posts: 13604
20 Dec 2014 07:39 AM
It is in the part.



A true rock is not a rock silly goose.
Report Abuse
TheBenSquare is not online. TheBenSquare
Joined: 13 Dec 2009
Total Posts: 13604
23 Dec 2014 12:13 PM
b1



A true rock is not a rock silly goose.
Report Abuse
maxomega3 is not online. maxomega3
Joined: 11 Jun 2010
Total Posts: 10668
23 Dec 2014 12:16 PM
no idea why you're using a _G variable at all

your parameter is the "toucher" or the thing that touched the brick and fired the event.
If this is a body part, then it's parent will be a character, and you check for that by making sure it has a humanoid.

Then, you use hit.Parent in your :GetPlayerFromCharacter (), as hit.Parent is a character
Report Abuse
maxomega3 is not online. maxomega3
Joined: 11 Jun 2010
Total Posts: 10668
23 Dec 2014 12:17 PM
oh, I see the confusion.

You can only call :GetPlayerFromCharacter () on game.Players

local plyr = game.Players:GetPlayerFromCharacter (hit.Parent)
Report Abuse
TheBenSquare is not online. TheBenSquare
Joined: 13 Dec 2009
Total Posts: 13604
24 Dec 2014 12:49 PM
implementing



A true rock is not a rock silly goose.
Report Abuse
TheBenSquare is not online. TheBenSquare
Joined: 13 Dec 2009
Total Posts: 13604
24 Dec 2014 12:53 PM
subsection title hereby described U.S. subtitle killing



A true rock is not a rock silly goose.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Game Design
   
 
   
  • 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