Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Data Persistence Not Working

Asked by 10 years ago

I am working on an intro script for a friend and I am trying to make it play only the first time you join. I looked up how Data Persistence works and found that you can use some methods to make it easier. I have done this exactly the way the tutorial suggested, and it hasn't worked.

game.Players.PlayerAdded:connect(function(player)
    player:WaitForDataReady()
    local joined = player:LoadString("AlreadyCome")
    if joined == nil then
    --DoIntroStuff

At the end of the script I have got

player:SaveString("AlreadyCome", "I'veBeenBefore")
    player.PlayerGui.NewGui.Exit.MouseButton1Down:connect(function(mouse)
    player.PlayerGui.NewGui:remove()

After looking at it through test mode, I can see that Boolean value 'DataReady' doesn't turn to true. Please help.

0
Is there an out put? If there is then please tell us. HexC3D 830 — 10y
0
You can't test DataPersistance in Play Solo, and I believe it's also no possible in Start Server, which is why DataReady turn true. User#2 0 — 10y

1 answer

Log in to vote
0
Answered by 10 years ago

Here's another idea how bout you put the intro in the ServerStorage then do this

game.Players.PlayerAdded:connect(function(p)
Intro = game.ServerStorage["Intro Name"]:Clone()
Intro.Parent = p.PlayerGui
end)

This was done on an IPad sorry if has simple errors

For only one time join do this

game.Players.PlayerAdded:connect(function(p)

Local bintro = Instance.new("BoolValue", p)
bintro.Name = "Intro"

p:WaitForDataReady()

p:LoadBool("intro") -- not sure if it is bool or Boolean

if p.Intro.Value == false then
Intro = game.ServerStorage["Intro Name"]:Clone()
Intro.Parent = p.PlayerGui
end
end)

game.Players.PlayerRemoving:connect(function(p) p:SaveBool("intro", p.Intro.Value) end)

0
I'm using a script to create the Intro inside player GUI, will that still work? Protoduction 216 — 10y
Ad

Answer this question