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

Why my DataBase won't save with this script? (LocalPlayer Problem i think)

Asked by
DSDamn 2
4 years ago

Don't judge me i'm new to scripting

But basically, when i try to add value to my "Job" leaderstat, my datastore doesn't find any problems, buy when i do it with this script, it won't save

Please help me

--[Variables]

local jobstat = game.Players.LocalPlayer.leaderstats.Job

local mainframe = script.Parent

local maintextlabel = mainframe.CenterFrame.ChooseLocation
--[Text Variables]

local maintext = "Please choose your first location..."

--[Pre-Starting Scripts]


mainframe.Position = UDim2.new(0,0,-1.5,0)

wait(4)

--[Starting Scripts]



if jobstat.Value >=1 then
    script.Parent.Parent:Destroy()
else
    script.Parent:TweenPosition(UDim2.new(0, 0, 0, 0),"InOut","Sine",0.3)
    jobstat.Value = 1

for i = 1, #maintext do
    maintextlabel.Text = string.sub(maintext, 1, i)
    wait(0.02)
    end
end


0
Give the datastore script zuup123 99 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

If filtering-enabled is on, local scripts don't have the ability to change the game. Try adding a Remote Event that will trigger this part of the code:

23  if jobstat.Value >=1 then
24      script.Parent.Parent:Destroy()
25  else
26      script.Parent:TweenPosition(UDim2.new(0, 0, 0, 0),"InOut","Sine",0.3)
27      jobstat.Value = 1
28   
29  for i = 1, #maintext do
30      maintextlabel.Text = string.sub(maintext, 1, i)
31      wait(0.02)
32      end
33  end

0
If I'm wrong, don't point it out, I will realize my mistake later. snowwyyyyy2 30 — 4y
0
Thanks ! :D DSDamn 2 — 4y
Ad

Answer this question