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

Issues with teleportation/data storage?

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

✓ Accepted answer

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.

3 comments

1

is there a way I can fix this then?

1

or can you please elaborate more?

0

Sure, make the owner do fix this problem meaning he will need to enable datastores

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

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