|
| 20 Mar 2016 11:10 PM |
But since when the character resets it "breaks" the scripts, whats the best way to use it with the character reseting?
|
|
|
| Report Abuse |
|
|
Laakari
|
  |
| Joined: 07 Aug 2014 |
| Total Posts: 17362 |
|
|
| 20 Mar 2016 11:12 PM |
Depends on what is happening in the script
|
|
|
| Report Abuse |
|
|
|
| 20 Mar 2016 11:14 PM |
I mean I can make it happen I was just trying to see whats the best way to do it, e.g multiple steps at a time
|
|
|
| Report Abuse |
|
|
|
| 20 Mar 2016 11:15 PM |
| Idk, maybe store inside the Player, like where leaderstats are usually stored. |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 20 Mar 2016 11:18 PM |
I cringed because what your saying makes no sense :/
|
|
|
| Report Abuse |
|
|
|
| 20 Mar 2016 11:19 PM |
you disgust me
im going to go suicide now
bye |
|
|
| Report Abuse |
|
|
Laakari
|
  |
| Joined: 07 Aug 2014 |
| Total Posts: 17362 |
|
|
| 20 Mar 2016 11:28 PM |
the player never gets reset
so put the script in the player and it never breaks wazah
|
|
|
| Report Abuse |
|
|
|
| 23 Mar 2016 08:44 PM |
^the character resets which then "breaks" the script
|
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 23 Mar 2016 08:45 PM |
| Example of one of your scripts. Just disable the script when the player dies then reenable it or waitforchild() or even the script should reset after the player dies |
|
|
| Report Abuse |
|
|
|
| 23 Mar 2016 08:58 PM |
Help me this thread is killing me.
PlayerScripts doesn't reset on death. Use CharacterAdded to run it each time the characater loads, or use PlayerGui. |
|
|
| Report Abuse |
|
|
|
| 23 Mar 2016 10:11 PM |
^ I know about all of those however I wanted to know the best way to do so.
|
|
|
| Report Abuse |
|
|
Darkenus
|
  |
| Joined: 17 Jul 2014 |
| Total Posts: 1997 |
|
|
| 23 Mar 2016 10:51 PM |
it really just depends on your script.
i have a bunch of scripts in starterplayerscripts that never break.
i remember once i had this script that when you reset, the script would break. (i havent dealt with starterplayerscripts in a while, so forgive me for my memory)
i just fixed it and it worked.
just some code tweeking.
perhaps post your code? |
|
|
| Report Abuse |
|
|
|
| 23 Mar 2016 11:12 PM |
-- This is just the outline I haven't added the fancy protector stuff in yet
local player = game.Players.LocalPlayer local camera = workspace.CurrentCamera local mouse = player:GetMouse() local HRP = player.Character.HumanoidRootPart local zoom = 12
local function selectable() --blah blah stuff end mouse.WheelForward:connect(function() zoom = math.max(10,zoom - 2) end) mouse.WheelBackward:connect(function() zoom = math.min(26,zoom + 2) end) mouse.Button2Down:connect(function() game.ReplicatedStorage.RightClick:FireServer(selectable()) end) wait(.1) game["Run Service"]:BindToRenderStep("Camera",1,function() HRP.CFrame = CFrame.new(HRP.Position,Vector3.new(mouse.Hit.X,HRP.Position.Y,mouse.Hit.Z)) camera.CoordinateFrame = CFrame.new(0,zoom,0,1,0,0,0,.017,.999,0,-.999,.017) + HRP.Position player.PlayerGui.Selection.Adornee = selectable() end)
|
|
|
| Report Abuse |
|
|
Darkenus
|
  |
| Joined: 17 Jul 2014 |
| Total Posts: 1997 |
|
|
| 24 Mar 2016 05:38 PM |
issue is here...
"local HRP = player.Character.HumanoidRootPart"
what happens if their player resets?
HRP is defined to player.Character.HumanoidRootPart ONCE.
when they die, that character is gone, so referencing it will get you an error.
heres a small solution, you could do something like
--basically it redefines HRP everytime the player respawns
local player = game.Players.LocalPlayer local HRP = nil
player.CharacterAdded:connect(function(chr) HRP = chr.HumanoidRootPart end)
another solution:
--basically it defines HRP BEFORE manipulating it
game["Run Service"]:BindToRenderStep("Camera",1,function() local HRP = chr.HumanoidRootPart HRP.CFrame = CFrame.new(HRP.Position,Vector3.new(mouse.Hit.X,HRP.Position.Y,mouse.Hit.Z)) camera.CoordinateFrame = CFrame.new(0,zoom,0,1,0,0,0,.017,.999,0,-.999,.017) + HRP.Position player.PlayerGui.Selection.Adornee = selectable() end) |
|
|
| Report Abuse |
|
|