|
| 30 Dec 2013 09:28 AM |
the function of this was to allow 'Blue' team members to pass through with a message and other team members to be teleported away from the part (where the script is it) but its not working.
user = game.Players:GetPlayerFromCharacter(script.Parent.Parent)
bin = script.Parent
function onTouch() if user.TeamColour == BrickColor.new("Bright blue") then local message = Instance.new('Message', game.Workspace) message.Text = "Let's Go Comrade! The Battle won't wait! " wait(2) message:Destroy() else local message = Instance.new('Message', game.Workspace) message.Text = "Go Away! You don't belong here! " wait(2) message:Destroy() game.Workspace.Player.Torso.CFrame = CFrame.new(Vector3.new(27.4, -337.4, 24.7)) end end
bin.Touched:connect(onTouch) |
|
|
| Report Abuse |
|
|
wazap
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 23234 |
|
|
| 30 Dec 2013 09:30 AM |
if user.TeamColour == BrickColor.new("Bright blue") then
Its
if user.TeamColor == BrickColor.new("Bright blue") then
Sorry, but ROBLOX was developed in America, you need to use American English. They're a bit biased. |
|
|
| Report Abuse |
|
|
| |
|
wazap
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 23234 |
|
|
| 30 Dec 2013 09:33 AM |
I over looked a lot of things. That was just a small detail...
bin = script.Parent
function onTouch(hit) if not (hit and hit.Parent and game.Players:GetPlayerFromCharacter(hit.Parent)) then return end
user = game.Players:GetPlayerFromCharacter(hit.Parent) if user.TeamColor == BrickColor.new("Bright blue") then local message = Instance.new('Message', game.Workspace) message.Text = "Let's Go Comrade! The Battle won't wait! " wait(2) message:Destroy() else local message = Instance.new('Message', game.Workspace) message.Text = "Go Away! You don't belong here! " wait(2) message:Destroy() game.Workspace.Player.Torso.CFrame = CFrame.new(Vector3.new(27.4, -337.4, 24.7)) end end
bin.Touched:connect(onTouch) |
|
|
| Report Abuse |
|
|
|
| 30 Dec 2013 09:36 AM |
| mind telling me why ? I am still learning to script |
|
|
| Report Abuse |
|
|
wazap
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 23234 |
|
|
| 30 Dec 2013 09:42 AM |
OK well first of all, user = game.Players:GetPlayerFromCharacter(script.Parent.Parent)
This will return nil most likely, because script.Parent.Parent is likely workspace or a person
So user.TeamColor will be nil.TeamColor, which wont work.
I know what you were trying to do. try to get the player from the character that touched the part, right?
the .Touched event has a variable that says what hit it That would be the function onTouched(hit) --the hit would be what hit the part
So now we check if hit was just a stray brick or an actual part of the player
if not (hit and hit.Parent = game.Players:GetPlayerFromCharacter(hit.Parent)) then return end --which is what this line of code does
If its just a stray brick, then nothing more happens
Now user = game.Players:GetPlayerFromCharacter(hit.Parent)
Now at this point, we are SURE that user exists. And then we do the rest of the code.
.... Kinda hard to follow? |
|
|
| Report Abuse |
|
|
|
| 30 Dec 2013 09:44 AM |
| heh yea kinda but I will pick it up slowly, also how do u change the properties of the message that comes out? |
|
|
| Report Abuse |
|
|
wazap
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 23234 |
|
|
| 30 Dec 2013 09:49 AM |
There really isnt much properties you can change for a Message object.
Message.Text, Message.Name, Message.Parent, Message.Archivable... those are about it. |
|
|
| Report Abuse |
|
|
|
| 30 Dec 2013 09:53 AM |
| how bout the transparency of it |
|
|
| Report Abuse |
|
|
wazap
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 23234 |
|
|
| 30 Dec 2013 09:54 AM |
| No. If you want something like Kohl's admin, thats a Gui. |
|
|
| Report Abuse |
|
|
|
| 30 Dec 2013 09:57 AM |
| ohh how do u do that then, change the message to a gui |
|
|
| Report Abuse |
|
|
wazap
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 23234 |
|
|
| 30 Dec 2013 10:01 AM |
That is a lot more complicated...
I'll give you the basics
local message = Instance.new("ScreenGui", user.PlayerGui) local fr = Instance.new("Frame",message") fr.Size = UDim2.new(1,0,1,0) fr.BackgroundTransparency = .5 local txt = Instance.new("TextLabel",fr) txt.Position = UDim2.new(.5,0,.5,0) txt.Text = ""--Message here
Good luck. |
|
|
| Report Abuse |
|
|
|
| 30 Dec 2013 10:09 AM |
| omg X.x mind explaining what all this means? Sorry for so many questions |
|
|
| Report Abuse |
|
|
|
| 30 Dec 2013 10:12 AM |
and why is this happening?
Workspace.Part.Script:9: unfinished string near '")' |
|
|
| Report Abuse |
|
|
| |
|
wazap
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 23234 |
|
|
| 30 Dec 2013 10:16 AM |
Because I am an idiot that is why
local message = Instance.new("ScreenGui", user.PlayerGui) local fr = Instance.new("Frame",message)--There was an extra " here fr.Size = UDim2.new(1,0,1,0) fr.BackgroundTransparency = .5 local txt = Instance.new("TextLabel",fr) txt.Position = UDim2.new(.5,0,.5,0) txt.Text = ""--Message here
I'm kind of too tired to explain all this right now.. x.x
So here http://wiki.roblox.com/index.php/Beginner%27s_GUI_Tutorial |
|
|
| Report Abuse |
|
|
|
| 30 Dec 2013 10:19 AM |
| Okai Thanks! That helped me alot. I tried to edit myself before u replied. I was more of an idoit, I placed one more " in front of message. xD |
|
|
| Report Abuse |
|
|