|
| 14 Jul 2016 03:41 PM |
local Redarmor = game.Workspace.Redarmor local Bluearmor = game.Workspace.Bluearmor
game.Players.PlayerAdded:connect(function(player) player.CharacterAdded:connect(function(character) local redswitcher = Redarmor:Clone() redswitcher.Parent = game.Workspace redswitcher.Head.Position = (character.Torso.Position) wait (5) redswitcher:Remove() end) end)
Okay, so I have some questions
1. How do I get redswitcher.Head to move to character.Torso's position? As you can see in the script I've tried that but failed.
2. I want this to be an if then statement like "if character.Team == ["Crimson"] then code here
but I don't know how to get the player's team from their character. Is there another way to do this?
Oh yeah, and if it's not clear enough I can explain but I think this should be good |
|
|
| Report Abuse |
|
|
Ryuzoji
|
  |
| Joined: 21 Dec 2015 |
| Total Posts: 937 |
|
|
| 14 Jul 2016 03:44 PM |
1. You gotta use Weld 2. Player.TeamColor
Let me make another post in a bit with the script |
|
|
| Report Abuse |
|
|
Ryuzoji
|
  |
| Joined: 21 Dec 2015 |
| Total Posts: 937 |
|
|
| 14 Jul 2016 03:47 PM |
| I'm assuming you want the armors to stick to the torso? |
|
|
| Report Abuse |
|
|
|
| 14 Jul 2016 03:48 PM |
"You gotta use Weld"
Yep, I should've been clearer, sorry Most of the time I've spent on my game has gone into a morph. When "Head" is touched it does what the morph does.
I've tried teleporting Head to the spawnpoint, which works and morphs the player properly, but that's not what I want. I want Head to teleport to the player regardless of their position-- so I don't want a weld
"Player.Teamcolor"
I tried this and didn't work but I think I'm structuring it wrong. |
|
|
| Report Abuse |
|
|
|
| 14 Jul 2016 03:48 PM |
"I'm assuming you want the armors to stick to the torso?"
As long as Head touches the player the armor will work fine. |
|
|
| Report Abuse |
|
|
Ryuzoji
|
  |
| Joined: 21 Dec 2015 |
| Total Posts: 937 |
|
|
| 14 Jul 2016 03:52 PM |
local RedArmor = game.Workspace.Redarmor local BlueArmor = game.Workspace.Bluearmor
game.Players.PlayerAdded:connect(function(Player) Player.CharacterAdded:connect(function(Character) if Player.TeamColor == "Red" then local RedSwitcher = RedArmor:Clone() RedSwitcher.Parent = game.Workspace RedSwitcher.Head.CFrame = CFrame.new(Character.Torso.Position) wait(5) RedSwitcher:Destroy() elseif Player.TeamColor == "Blue" then local BlueSwitcher = BlueArmor:Clone() BlueSwitcher.Parent = game.Workspace BlueSwitcher.Head.CFrame = CFrame.new(Character.Torso.Position) wait(5) BlueSwitcher:Destroy() end end) end)
I'm not sure if this is what you want? |
|
|
| Report Abuse |
|
|
|
| 14 Jul 2016 03:55 PM |
| It is what I want, but it's not working. I don't see any errors but when I search for the block it looks like it's not teleporting to the position |
|
|
| Report Abuse |
|
|
|
| 14 Jul 2016 03:57 PM |
Possibly important info:
Teams are named Red and Blue, the TeamColors are Crimson and Lapis. I changed the script to reflect that |
|
|
| Report Abuse |
|
|
Ryuzoji
|
  |
| Joined: 21 Dec 2015 |
| Total Posts: 937 |
|
|
| 14 Jul 2016 03:58 PM |
@RowanMcJak1
It should work. Maybe because the block is invisible? Check in the explorer tab to see if it cloned. |
|
|
| Report Abuse |
|
|
|
| 14 Jul 2016 03:59 PM |
| I made the transparency of Head zero so I could see it. It doesn't teleport to my position. |
|
|
| Report Abuse |
|
|
Ryuzoji
|
  |
| Joined: 21 Dec 2015 |
| Total Posts: 937 |
|
|
| 14 Jul 2016 03:59 PM |
local RedArmor = game.Workspace.Redarmor local BlueArmor = game.Workspace.Bluearmor
game.Players.PlayerAdded:connect(function(Player) Player.CharacterAdded:connect(function(Character) if Player.TeamColor == "Red" then local RedSwitcher = RedArmor:Clone() RedSwitcher.Transparency = 0 RedSwitcher.Anchored = true RedSwitcher.CanCollide = false RedSwitcher.Parent = game.Workspace RedSwitcher.Head.CFrame = CFrame.new(Character.Torso.Position) wait(5) RedSwitcher:Destroy() elseif Player.TeamColor == "Blue" then local BlueSwitcher = BlueArmor:Clone() BlueSwitcher.Transparency = 0 BlueSwitcher.Anchored = true BlueSwitcher.CanCollide = false BlueSwitcher.Parent = game.Workspace BlueSwitcher.Head.CFrame = CFrame.new(Character.Torso.Position) wait(5) BlueSwitcher:Destroy() end end) end)
Try? |
|
|
| Report Abuse |
|
|
|
| 14 Jul 2016 04:04 PM |
RedArmor and Bluearmor are models, Head is a member of the model and that has an OnTouched script that causes the morph to happen. So making the model transparent is useless and it couldn't be CanCollide false.
Even if I change those to make Head not transparent etc. it still doesn't work. Maybe I should try play online? |
|
|
| Report Abuse |
|
|
|
| 14 Jul 2016 04:04 PM |
| If I check explorer it seems to not be creating a clone? this is odd |
|
|
| Report Abuse |
|
|
Ryuzoji
|
  |
| Joined: 21 Dec 2015 |
| Total Posts: 937 |
|
|
| 14 Jul 2016 04:07 PM |
Ah sorry dude: this should fix it
local RedArmor = game.Workspace.Redarmor local BlueArmor = game.Workspace.Bluearmor
game.Players.PlayerAdded:connect(function(Player) Player.CharacterAdded:connect(function(Character) if tostring(Player.Team) == "Crimson" then local RedSwitcher = RedArmor:Clone() RedSwitcher.Parent = game.Workspace RedSwitcher.Head.CFrame = CFrame.new(Character.Torso.Position) wait(5) RedSwitcher:Destroy() elseif tostring(Player.Team) == "Lapis" then local BlueSwitcher = BlueArmor:Clone() BlueSwitcher.Parent = game.Workspace BlueSwitcher.Head.CFrame = CFrame.new(Character.Torso.Position) wait(5) BlueSwitcher:Destroy() end end) end)
Haven't scripted in so long, didn't know they added Player.Team. If you're going to use TeamColor, you're supposed to use "BrickColor.new()", and if you're using Player.Team, convert it using "tostring()" |
|
|
| Report Abuse |
|
|
|
| 14 Jul 2016 04:10 PM |
Still doesn't work, I also tested it online just in case it was an issue of PlayerAdded
I also looked in the explorer. No visible clone. |
|
|
| Report Abuse |
|
|
Ryuzoji
|
  |
| Joined: 21 Dec 2015 |
| Total Posts: 937 |
|
|
| 14 Jul 2016 04:16 PM |
| Ah the problem is with the positioning. It clones but it doesn't position right. I haven't scripted in so long, idk the problem. Lemme try to fix it. |
|
|
| Report Abuse |
|
|
Ryuzoji
|
  |
| Joined: 21 Dec 2015 |
| Total Posts: 937 |
|
|
| 14 Jul 2016 04:20 PM |
local Redarmor = game.Workspace.Redarmor local Bluearmor = game.Workspace.Bluearmor
game.Players.PlayerAdded:connect(function(Player) Player.CharacterAdded:connect(function(Character) if tostring(Player.Team) == "Crimson" then local RedSwitcher = Redarmor:Clone() RedSwitcher.Parent = game.Workspace wait() RedSwitcher.Head.CFrame = CFrame.new(Character.Torso.Position) wait(5) RedSwitcher:Destroy() elseif tostring(Player.Team) == "Lapis" then local BlueSwitcher = Bluearmor:Clone() BlueSwitcher.Parent = game.Workspace wait() BlueSwitcher.Head.CFrame = CFrame.new(Character.Torso.Position) wait(5) BlueSwitcher:Destroy() end end) end)
The script is right. When I tested it using 1 player server, I spawned at the spawn location but the brick spawned as if the spawn location wasn't there. Meaning the spawning with a spawn location has a slight delay. I added a wait() to see if it made a difference, this time it spawned while I was on the spawn location. |
|
|
| Report Abuse |
|
|
|
| 14 Jul 2016 04:45 PM |
| omg. It's actually my fault, the teams were named Red and blue but I changed it and it works great now. Thanks a ton for sticking around to help- I think I'll give you some in game stuff when the game launches, but it might be a while (and you might not even care) |
|
|
| Report Abuse |
|
|
Ryuzoji
|
  |
| Joined: 21 Dec 2015 |
| Total Posts: 937 |
|
|
| 14 Jul 2016 05:00 PM |
@RowanMcJak1
Haha looking forward to your game man :) |
|
|
| Report Abuse |
|
|