generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: So I like using StarterPlayerScripts

Previous Thread :: Next Thread 
MrJoeyJoeJoey is not online. MrJoeyJoeJoey
Joined: 20 Aug 2011
Total Posts: 20787
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 is not online. Laakari
Joined: 07 Aug 2014
Total Posts: 17362
20 Mar 2016 11:12 PM
Depends on what is happening in the script


Report Abuse
MrJoeyJoeJoey is not online. MrJoeyJoeJoey
Joined: 20 Aug 2011
Total Posts: 20787
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
GraphicsSettings is not online. GraphicsSettings
Joined: 12 Sep 2013
Total Posts: 2883
20 Mar 2016 11:15 PM
Idk, maybe store inside the Player, like where leaderstats are usually stored.
Report Abuse
MrJoeyJoeJoey is not online. MrJoeyJoeJoey
Joined: 20 Aug 2011
Total Posts: 20787
20 Mar 2016 11:16 PM
cringe


Report Abuse
GraphicsSettings is not online. GraphicsSettings
Joined: 12 Sep 2013
Total Posts: 2883
20 Mar 2016 11:16 PM
k kys
Report Abuse
MrJoeyJoeJoey is not online. MrJoeyJoeJoey
Joined: 20 Aug 2011
Total Posts: 20787
20 Mar 2016 11:18 PM
I cringed because what your saying makes no sense :/


Report Abuse
GraphicsSettings is not online. GraphicsSettings
Joined: 12 Sep 2013
Total Posts: 2883
20 Mar 2016 11:19 PM
you disgust me

im going to go suicide now

bye
Report Abuse
Laakari is not online. 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
MrJoeyJoeJoey is not online. MrJoeyJoeJoey
Joined: 20 Aug 2011
Total Posts: 20787
23 Mar 2016 08:44 PM
^the character resets which then "breaks" the script


Report Abuse
TimeTicks is not online. 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
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
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
MrJoeyJoeJoey is not online. MrJoeyJoeJoey
Joined: 20 Aug 2011
Total Posts: 20787
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 is not online. 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
MrJoeyJoeJoey is not online. MrJoeyJoeJoey
Joined: 20 Aug 2011
Total Posts: 20787
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 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image