|
| 11 Apr 2013 08:48 PM |
So I made a script so when I enter the game a brick is on the top of my head, but when I leave the brick stays where was last, anyways you would I delete the brick after I leave?
while wait() do if game.Players:FindFirstChild("mattandjeffhardy619") then game.Workspace.Part1.Position = CFrame.new(game.Workspace.mattandjeffhardy619.Torso.Position) * Vector3.new(0, 8, 0) end end
|
|
|
| Report Abuse |
|
|
|
| 11 Apr 2013 08:56 PM |
| Sorry, I was writing this fast, *How would I delete the brick after I leave?* |
|
|
| Report Abuse |
|
|
777MrEpic
|
  |
| Joined: 17 Oct 2012 |
| Total Posts: 3998 |
|
| |
|
FoggedOut
|
  |
| Joined: 09 Dec 2011 |
| Total Posts: 3021 |
|
|
| 11 Apr 2013 08:57 PM |
It will take me awhile to figure out becuase I'm new to scripting, but I could figure it out.
BTW, I was wondering what you ment up there. I would have fxied for you, but I would have fixed it wrong; I bet anyways I would. xD |
|
|
| Report Abuse |
|
|
dnic1997
|
  |
| Joined: 08 May 2010 |
| Total Posts: 309 |
|
|
| 11 Apr 2013 08:59 PM |
Use it the same way as a Data Persistence:
game.Players.PlayerLeaving:connect(function(player) pcall(function() brick:remove() end) end)
It's something like that, I can't remember it fully. |
|
|
| Report Abuse |
|
|
UnBuild
|
  |
| Joined: 22 Mar 2013 |
| Total Posts: 3233 |
|
|
| 11 Apr 2013 09:00 PM |
| Parent the part to the lighting when you leave. |
|
|
| Report Abuse |
|
|
|
| 11 Apr 2013 09:05 PM |
| @ UnBuild, that's what I'm asking how do I make it detect when I'm leaving? |
|
|
| Report Abuse |
|
|
|
| 11 Apr 2013 09:07 PM |
game.Players.PlayerRemoving:connect(function() --stuff end)
like that? o-o |
|
|
| Report Abuse |
|
|
UnBuild
|
  |
| Joined: 22 Mar 2013 |
| Total Posts: 3233 |
|
|
| 11 Apr 2013 09:10 PM |
One way, not the best, but
if Game.Players:FindFirstChild("YourName") == nil then --Stuff end |
|
|
| Report Abuse |
|
|
|
| 11 Apr 2013 09:39 PM |
It's not working 100%, I fell like I'm almost there but not quiet, here's what I got
local Part = game.Lighting.Part1 local PartCopy = Part:Clone()
while wait() do if game.Players:FindFirstChild("Player1") then PartCopy.Parent = Workspace game.Workspace.Part1.Position = CFrame.new(game.Workspace.Player1.Torso.Position) * Vector3.new(0, 8, 0) elseif game.Players:FindFirstChild("Player1") == nil then game.Workspace:FindFirstChild("Part1"):remove() break end end
|
|
|
| Report Abuse |
|
|
|
| 11 Apr 2013 09:48 PM |
game.Players.PlayerAdded:connect(function(player) wait() local brick=Instance.new("Part",workspace) brick.CFrame = player.Character.Head.CFrame game.Players.PlayerRemoving:connect(function(left) if player.Name==left.Name then brick:Destroy() end end)
end)
--try this. Idk if it works though xP |
|
|
| Report Abuse |
|
|
|
| 11 Apr 2013 09:49 PM |
| I would us :PlayerRemoving |
|
|
| Report Abuse |
|
|
nuke009
|
  |
| Joined: 22 Nov 2009 |
| Total Posts: 1930 |
|
|
| 12 Apr 2013 02:26 AM |
| Use PlayerRemoving, it fires straight after someone leaves. |
|
|
| Report Abuse |
|
|
UnBuild
|
  |
| Joined: 22 Mar 2013 |
| Total Posts: 3233 |
|
|
| 12 Apr 2013 10:42 AM |
Because of this
while wait() do if game.Players:FindFirstChild("mattandjeffhardy619") then game.Workspace.Part1.Position = CFrame.new(game.Workspace.mattandjeffhardy619.Torso.Position) * Vector3.new(0, 8, 0) end end
I just kinda assumed he didn't know how to use PlayerRemoving |
|
|
| Report Abuse |
|
|