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

Issues with teleportation/data storage?

Asked by 4 years ago

I don't know what I need to do in order for this to work, help would be appreciated, I am trying to see if the player who clicked on the play gui button has any data stored in a data storage location. If they don't I want to teleport them to a tutorial place, but when I click the play button nothing happens

Error:

19:38:50.304 - 502: API Services rejected request with error. HTTP 403 (Forbidden) 19:38:50.305 - Stack Begin 19:38:50.306 - Script 'ServerScriptService.Script', Line 12 19:38:50.306 - Stack End

Local Script:

--Variables
local camera  = workspace.CurrentCamera
local camPart = workspace.maincam
local frame = script.Parent:WaitForChild("Frame")
local PlayBtn = frame:WaitForChild("Play Button")
local Credits = frame:WaitForChild("Credits")
local Title = frame:WaitForChild("Title")
local GamePopup = script.Parent:WaitForChild("Loadingtxt")   
local repstorage = game:GetService("ReplicatedStorage")
local event = repstorage:WaitForChild("noob")

spawn(function()


    camera.CameraType = "Scriptable"

        camera.CFrame = camPart.CFrame
        frame.Visible = true

end)

PlayBtn.MouseButton1Click:Connect(function()
    GamePopup.Visible = true
    local player = game.Players.LocalPlayer 
    event:FireServer(player)
end)

Server Script:

local DataStoreService = game:GetService("DataStoreService")
local tpService = game:GetService("TeleportService")

local Tutorial = 4653251860
local Playground = ...
local newplayer = DataStoreService:GetDataStore("NoobCheck")
local repstorage = game:GetService("ReplicatedStorage")
local event = repstorage:WaitForChild("noob")

local function checkplayer(player)
    local check
    check = newplayer:GetAsync(player.UserId.."-test")
    if(check == nil)then
        tpService:Teleport(Tutorial,player.UserId)
    else
        tpService:Teleport(Playground,player.UserId)
    end
end

event.OnServerEvent:Connect(checkplayer)

2 answers

Log in to vote
1
Answered by
raid6n 2196 Moderation Voter Community Moderator
4 years ago
Edited 4 years ago

This question has been asked several times before. If you aren’t the owner of the place, you cannot use its DataStores, hence HTTP 403 Forbidden.

1
is there a way I can fix this then? cyanslime123 23 — 4y
1
or can you please elaborate more? cyanslime123 23 — 4y
0
Sure, make the owner do fix this problem meaning he will need to enable datastores raid6n 2196 — 4y
Ad
Log in to vote
1
Answered by 4 years ago

Never mind I fixed it, my datastore wasn't enabled which you can do in the game settings in studio

Answer this question