|
| 11 Oct 2015 05:51 PM |
Would someone help me make an arrest tool? When you hit another player with the tool they should be teleported into a building/prison(I can make that much) but after maybe 5-10minutes it should respawn them as another team. Thanks, if I wasn't clear on anything let me know! |
|
|
| Report Abuse |
|
|
|
| 11 Oct 2015 05:54 PM |
Make a tool. In the tool's handle or something:
script.Parent.Touched:connect(function(hit) if hit.Parent then local player = game.Players:GetPlayerFromCharacter(hit.Parent) if player then player.Character.Torso.CFrame = CFrame.new(x, y, z) -- jail spawn wait(300) -- 5 minutes player.TeamColor = BrickColor.new("name") -- new team color name player.Character.Torso.CFrame = CFrame.new(x, y, z) -- new spawn end end end)
-The [Guy] |
|
|
| Report Abuse |
|
|
|
| 11 Oct 2015 05:55 PM |
actually nevermind that's a terrible way to do it because if the player with the tool dies, I think that script would stop. Instead, have it clone a script into the player he hit and that script will do the waiting and team changing handling, and then it will destroy itself.
-The [Guy] |
|
|
| Report Abuse |
|
|
| |
|
|
| 11 Oct 2015 05:58 PM |
First, remember that Cframe is a place on the map, given by location. Therefore, if you place a brick at a certain position, then you can obtain the cframe value by that position. That is how to best use this script posted above. |
|
|
| Report Abuse |
|
|
|
| 11 Oct 2015 06:01 PM |
You would put a script object into the script that is in the tool... like this
> Tool >> Script for tool >>> Script that gets cloned into the hit player (disabled by default)
Then in the script for tool... script.Parent.Touched:connect(function(hit) if hit.Parent then local player = game.Players:GetPlayerFromCharacter(hit.Parent) if player then player.Character.Torso.CFrame = CFrame.new(x, y, z) -- jail spawn local respawnScript = script.Script:Clone() respawnScript.Parent = player respawnScript.Disabled = false end end end)
Then in the script that gets cloned into the hit player:
wait(300) -- 5 minutes script.Parent.TeamColor = BrickColor.new("name") -- new team color name script.Parent.Character.Torso.CFrame = CFrame.new(x, y, z) -- new spawn script:Destroy()
-The [Guy] |
|
|
| Report Abuse |
|
|
|
| 11 Oct 2015 06:02 PM |
ehh add a debounce to that .Touched function otherwise it will clone a ton of scripts into the player lol
-The [Guy] |
|
|
| Report Abuse |
|
|
| |
|
|
| 11 Oct 2015 06:26 PM |
http://wiki.roblox.com/index.php/Debounce basically create an if else script, to force the user to only be hit once by the tool. Debounce simply creates a controlled environment |
|
|
| Report Abuse |
|
|
| |
|
|
| 11 Oct 2015 06:32 PM |
So the debounce could be like this, where this is the script for the tool.
local debounce = false script.Parent.Touched:connect(function(hit) if debounce then return end if hit.Parent then local player = game.Players:GetPlayerFromCharacter(hit.Parent) if player then debounce = true player.Character.Torso.CFrame = CFrame.new(x, y, z) -- jail spawn local respawnScript = script.Script:Clone() respawnScript.Parent = player respawnScript.Disabled = false wait(.3) debounce = false end end end)
-The [Guy] |
|
|
| Report Abuse |
|
|
|
| 11 Oct 2015 06:33 PM |
| Thanks! I really appreciate all your help these past few days! |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 11 Oct 2015 07:07 PM |
| Use HTML! It'll make everything easier for you! |
|
|
| Report Abuse |
|
|
| |
|
|
| 11 Oct 2015 07:35 PM |
| Well the script didn't work... Does the tool need a handle? |
|
|
| Report Abuse |
|
|
|
| 11 Oct 2015 07:36 PM |
| Every tool needs a handle unless you go free rider, with hopperbins |
|
|
| Report Abuse |
|
|