#HELP PLEASE

17 messages · Page 1 of 1 (latest)

raven hare
#

this is the first script:local DataStore = game:GetService("DataStoreService")
local ds = DataStore:GetDataStore("LeaderStatSave")
local ds2 = DataStore:GetDataStore("LeaderStatSave2")
game.Players.PlayerAdded:connect(function(player)
local leader = Instance.new("Folder",player)
leader.Name = "leaderstats"
local Cash = Instance.new("IntValue",leader)
Cash.Name = "Coins"
local Cash2 = Instance.new("IntValue",leader)
Cash2.Name = "AREA"
Cash.Value = ds:GetAsync(player.UserId) or 0
ds:SetAsync(player.UserId, Cash.Value)
Cash2.Value = ds2:GetAsync(player.UserId) or 0
ds2:SetAsync(player.UserId, Cash2.Value)
Cash.Changed:connect(function()
ds:SetAsync(player.UserId, Cash.Value)
end)
Cash2.Changed:connect(function()
ds2:SetAsync(player.UserId, Cash2.Value)
end)end)
game.Players.PlayerRemoving:connect(function(player)
ds:SetAsync(player.UserId, player.leaderstats.Cash.Value)
ds2:SetAsync(player.UserId, player.leaderstats.Steps.Value)
end)
this is a leaderstats script which works.
second script
script.Parent.MouseButton1Click:Connect(function()
local player = game.Players.LocalPlayer
local leaderstats = player:WaitForChild("leaderstats")
local coins = leaderstats:WaitForChild("Coins")
if coins.Value >= 100 then
coins.Value = coins.Value - 100
else
script.Parent.Text = "NOT ENOUGH"
wait(2)
script.Parent.Text = "BUY"
end
end)
this is the by next area button which again works

#

but now this is the third localscript in starterplayerscripts which does NOT work
function AREACHECK()
local gate = game.Workspace.scndgate
local player = game.Players.LocalPlayer
local leaderstats = player:WaitForChild("leaderstats")
local coins = leaderstats:WaitForChild("Coins")
local area = leaderstats:WaitForChild("AREA")
if area == 1 then
gate.Transparency = 1
gate.CanTouch = false
gate.CanCollide = false
gate.SurfaceGui.Enabled = false
end
while true do
wait(0.25)
AREACHECK()
end
end

frozen sentinel
#

please

raven hare
vestal eagle
# raven hare ?

if you are sending any scripts, send them like on that picture

#
print("Hi")

is easier to read than
print("Hi")

raven hare
#

Sorry

#
local DataStore = game:GetService("DataStoreService")
local ds = DataStore:GetDataStore("LeaderStatSave")
local ds2 = DataStore:GetDataStore("LeaderStatSave2")
game.Players.PlayerAdded:connect(function(player)
local leader = Instance.new("Folder",player)
leader.Name = "leaderstats"    
local Cash = Instance.new("IntValue",leader)
Cash.Name = "Coins"
local Cash2 = Instance.new("IntValue",leader)
Cash2.Name = "AREA"
Cash.Value = ds:GetAsync(player.UserId) or 0
ds:SetAsync(player.UserId, Cash.Value)
Cash2.Value = ds2:GetAsync(player.UserId) or 0
ds2:SetAsync(player.UserId, Cash2.Value)
Cash.Changed:connect(function()
ds:SetAsync(player.UserId, Cash.Value)
end)
Cash2.Changed:connect(function()
ds2:SetAsync(player.UserId, Cash2.Value)
end)end)
game.Players.PlayerRemoving:connect(function(player)
ds:SetAsync(player.UserId, player.leaderstats.Cash.Value)
ds2:SetAsync(player.UserId, player.leaderstats.Steps.Value)
end)

   
#
script.Parent.MouseButton1Click:Connect(function()
    local player = game.Players.LocalPlayer
    local leaderstats = player:WaitForChild("leaderstats")
    local coins = leaderstats:WaitForChild("Coins")
    if coins.Value >= 100  then
        coins.Value = coins.Value - 100
    else 
        script.Parent.Text = "NOT ENOUGH"
        wait(2)
        script.Parent.Text = "BUY"
        end
end) ```
#

These script work fine but this last local script does NOT

#

function AREACHECK()
    local gate = game.Workspace.scndgate
    local player = game.Players.LocalPlayer
    local leaderstats = player:WaitForChild("leaderstats")
    local coins = leaderstats:WaitForChild("Coins")
    local area = leaderstats:WaitForChild("AREA")
    if area == 1 then    
    gate.Transparency = 1
    gate.CanTouch = false
    gate.CanCollide = false 
    gate.SurfaceGui.Enabled = false
    end    
    while true do
        wait(0.25)
        AREACHECK()
    end
end```
vestal eagle
#

are there any errors in the output?

#

also, where did u put this last script?

idle rain
raven hare
idle rain
#

what is the problem