hullo, can someone help me this is my script
im dumb and still learning
local players = game:GetService("Players")
local dataStoreService = game:GetService("DataStoreService")
local playerDataStore = dataStoreService:GetDataStore("PlayerData")
players.PlayerAdded:Connect(function(player)
local success, data = pcall(function()
return playerDataStore:GetAsync("Player_"..player.UserId)
end)
if success and data then
print(player.Name.." has played before")
game.StarterGui.ScreenGui.Frame.Visible = true
else
print(player.Name.." is new to the game")
game.StarterGui.ScreenGui.Frame2.Visible = true
local success, err = pcall(function()
playerDataStore:SetAsync("Player_"..player.UserId, true)
end)
if not success then
warn("Error saving data for "..player.Name..": "..err)
end
end
end)
i watched a yt tutorial but idk how to use removeasync
,thx
This is easy… other than you have to wait from them to login to remove it.
There are other ways… DataStore Editor, is worth the investment in my opinion.
local dataStoreService = game:GetService("DataStoreService")
local playerDataStore = dataStoreService:GetDataStore("PlayerData")
pcall(function()
playerDataStore:RemoveAsync("Player_"..player.UserId)
end)
If you’re doing your data like that, Id say you’re watching the wrong Video.
Watch This one by MonzterDev
This is significantly better. Id just trash what you got and watch this, I know this might seem overwhelming but if you’re serious about doing things better than you are now you can DM me and I will help you with this.
uh hello again why does my script not working on roblox/experience but in studio it works fine (its like new players get different gui and old players get another different gui and still using my old script cus i was testing it)
It seems that in Studio, the camera isn’t attaching to the character and is instead using a custom camera setup, whereas in the live game, the camera defaults to the character’s camera. This behavior appears to be related to a camera/script type issue rather than a data-related problem.
I believe I can explain this further even without seeing the script, but let’s continue this conversation via DM since it’s not directly relevant to the original post.