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 » Scripting Helpers
Home Search
 

Re: Dp not working?

Previous Thread :: Next Thread 
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
14 May 2014 12:55 PM
simple script, but it doesn't work..

basicly,its supposed to save and load the characters torso cframe

but it doesn't work..

AND STOP TELLING ME TO USE DATASTORE,IT MAKES NO DIFFERENCE..

can someone please just tell me why this wont work?



game.Players.PlayerAdded:connect(function(p)
p:WaitForDataReady()
C = Instance.new("CFrameValue",p)
C.Name = "CF"
cf = p:LoadInstance("CF")
if cf~=nil then
C.Value = cf.Value
p.CharacterAdded:connect(function(c)
wait()
local m = Instance.new("Message",p.PlayerGui)
m.Text = "succesfully loaded last known position!"
c.Torso.CFrame = C.Value
game.Debris:AddItem(m,2)
end)
end
end)
while wait(2) do
for i,v in pairs(game.Players:GetPlayers()) do
if v.Character and v.Character:FindFirstChild("Torso") then
v:WaitForDataReady()
t = v.Torso
c = t.CFrame
if v:FindFirstChild("CF") then
v.CF.Value = c
v:SaveInstance("CF",v.CF)
end
end
end
end
Report Abuse
Azeroth17 is not online. Azeroth17
Joined: 13 May 2014
Total Posts: 86
14 May 2014 01:03 PM
Only joined couple of days ago I don't know anything about this kind of dp, but this line popped out at me:



if v:FindFirstChild("CF") then

Will this ever be true?
Report Abuse
Azeroth17 is not online. Azeroth17
Joined: 13 May 2014
Total Posts: 86
14 May 2014 01:03 PM
nvm lmao
Report Abuse
Azeroth17 is not online. Azeroth17
Joined: 13 May 2014
Total Posts: 86
14 May 2014 01:04 PM
Idk it looks completely fine but why are you not using a .PlayerRemoving event?
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
14 May 2014 01:04 PM
well,i found 1 prob
i was looking for the torso in the player instead of char by accident
qq

v.Torso

v.Character.Torso
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
14 May 2014 01:05 PM
@az

cuz the char will be nil on playerremoving, plus, playerremoving and dp often don't work so well..its best to auto save
Report Abuse
Azeroth17 is not online. Azeroth17
Joined: 13 May 2014
Total Posts: 86
14 May 2014 01:05 PM
omg found it

t = v.Torso
c = t.CFrame
Report Abuse
Azeroth17 is not online. Azeroth17
Joined: 13 May 2014
Total Posts: 86
14 May 2014 01:06 PM
Awks we posted at similar times.

Is it working now?
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
14 May 2014 01:07 PM
nope, and no errors from server console..

idk why it wont work qq
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
14 May 2014 01:12 PM
BUMPPP
Report Abuse
Azeroth17 is not online. Azeroth17
Joined: 13 May 2014
Total Posts: 86
14 May 2014 01:13 PM
I've never actually made anything on roblox yet so:

what would happen if you used the :GetChildren() method when there were no players?

Would it return an empty table or would it error?
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
14 May 2014 01:14 PM
it wont error i don't think..idk
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
14 May 2014 01:16 PM
wait,it is working..

but not when they enter,only when they reset..

qq
Report Abuse
wazap is not online. wazap
Joined: 29 Jun 2007
Total Posts: 23234
14 May 2014 01:17 PM
while wait(2) do
for i,v in pairs(game.Players:GetPlayers()) do
if v.Character and v.Character:FindFirstChild("Torso") then
v:WaitForDataReady() --wat if this never loads :o
t = v.Torso
c = t.CFrame
if v:FindFirstChild("CF") then
v.CF.Value = c
v:SaveInstance("CF",v.CF)
end
end
end
end
Report Abuse
Azeroth17 is not online. Azeroth17
Joined: 13 May 2014
Total Posts: 86
14 May 2014 01:19 PM
Lol'd.

What is happening when you test it? Nothing?
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
14 May 2014 01:20 PM
ok,now im confused..

i edited it a bit,and changed it to repeat wait() until p.Character in the loading

the msg shows up,but it doesn't work.......it doesn't move the char..
Report Abuse
Azeroth17 is not online. Azeroth17
Joined: 13 May 2014
Total Posts: 86
14 May 2014 01:20 PM
Isn't that a bad thing that it's happening when they reset? Or is that what you want?
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
14 May 2014 01:21 PM
like i just said,i changed it so that it only happens when they join..
but the msg shows up,but it doesn't move my character..
Report Abuse
Azeroth17 is not online. Azeroth17
Joined: 13 May 2014
Total Posts: 86
14 May 2014 01:23 PM
Post the edited code. Just make sure you take out the .CharacterAdded event, which I assume it what u did
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
14 May 2014 01:24 PM
game.Players.PlayerAdded:connect(function(p)
p:WaitForDataReady()
C = Instance.new("CFrameValue",p)
C.Name = "CF"
cf = p:LoadInstance("CF")
if cf~=nil then
C.Value = cf.Value
repeat wait() until p.Character
wait()
c = p.Character
local m = Instance.new("Message",p.PlayerGui)
m.Text = "succesfully loaded last known position!"
c.Torso.CFrame = C.Value
game.Debris:AddItem(m,2)
end
end)
while wait(2) do
for i,v in pairs(game.Players:GetPlayers()) do
if v.Character and v.Character:FindFirstChild("Torso") then
v:WaitForDataReady()
t = v.Character.Torso
c = t.CFrame
if v:FindFirstChild("CF") then
v.CF.Value = c
v:SaveInstance("CF",v.CF)
end
end
end
end
Report Abuse
Azeroth17 is not online. Azeroth17
Joined: 13 May 2014
Total Posts: 86
14 May 2014 01:29 PM
Is it possible that the torso has not loaded yet?
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
14 May 2014 01:40 PM
if v.Character and v.Character:FindFirstChild("Torso") then

repeat wait() until p.Character
wait()
c = p.Character

dude,theres no errors,it doesn't work..
Report Abuse
Azeroth17 is not online. Azeroth17
Joined: 13 May 2014
Total Posts: 86
14 May 2014 01:54 PM
repeat wait() until p.Character
wait()

Try waiting for the torso as well?
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
14 May 2014 02:09 PM
I told you,obviously the torso IS there,BECAUSE IT DOESNT ERROR

THE MSG POPS UP,BUT IT DOESNT MOVE THE CHARACTERRRRRRR
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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