Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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


1 comment

0

Give the datastore script

1 answer

✓ Accepted answer

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

2 comments

0

If I'm wrong, don't point it out, I will realize my mistake later.

0

Thanks ! :D

This discussion is preserved as it was. New answers, comments, and votes are closed.