generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
We use cookies to offer you a better experience. By using Roblox.com, you are agreeing to our Privacy and Cookie Policy.
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Create Place API not working. No errors.

Previous Thread :: Next Thread 
8BitDeveloping is not online. 8BitDeveloping
Joined: 09 Aug 2011
Total Posts: 1472
23 Jul 2015 11:39 AM
So I'm trying to create a place for the player to have, their own little place. But I get no errors, and it doesn't create the place. This is a LocalScript in a TextButton.

--8BitDeveloping

game:GetService('TeleportService').CustomizedTeleportUI = true

ds = game:GetService("DataStoreService"):GetGlobalDataStore()

function debounce(func)
local isRunning = false
return function(...)
if not isRunning then
isRunning = true
func(...)
isRunning = false
end
end
end

function _sendPlayerToScareZone(player)
local playerIdentity = player.Name .. '(' .. player.userId .. ')'

local playerKey = 'player_' .. player.userId
local playerData = ds:GetAsync(playerKey)

if playerData then
if playerData.personalPlaceId <= 0 then
playerData = nil
end
end

if not playerData then
newPlaceId = game:GetService("AssetService"):CreatePlaceAsync('Frenzy: Eternity map for ' .. playerIdentity, 92697995)

playerData = {
personalPlaceId = newPlaceId
}

ds:SetAsync(playerKey, playerData)
end

if playerData and playerData.personalPlaceId then
game:GetService('TeleportService'):Teleport(playerData.personalPlaceId, player)
end
end
local sendPlayerToBuildZone = debounce(_sendPlayerToScareZone)

-- Click event function
function click(Source)
local player = game.Players.LocalPlayer
if player then
if player.userId > 0 then
_sendPlayerToScareZone(player)
end
end
end

script.Parent.MouseButton1Click:connect(click)


i really really really wanna run over youuu
Report Abuse
8BitDeveloping is not online. 8BitDeveloping
Joined: 09 Aug 2011
Total Posts: 1472
23 Jul 2015 11:44 AM
Actually, I'm getting the "DataStore cannot be accessed" error from this line:

ds = game:GetService("DataStoreService"):GetGlobalDataStore()

help


i really really really wanna run over youuu
Report Abuse
IoIiderp is not online. IoIiderp
Joined: 05 Feb 2012
Total Posts: 8613
23 Jul 2015 11:46 AM
You used play solo?
Report Abuse
robokittydestroyer is not online. robokittydestroyer
Joined: 20 Jul 2010
Total Posts: 311
23 Jul 2015 11:46 AM
DataStore only works in server scripts.
Report Abuse
8BitDeveloping is not online. 8BitDeveloping
Joined: 09 Aug 2011
Total Posts: 1472
23 Jul 2015 11:48 AM
So how would I get the datastore from a server script and insert it into the localscript? Global variable? or..


i really really really wanna run over youuu
Report Abuse
DigitalVeer is not online. DigitalVeer
Joined: 23 Jun 2009
Total Posts: 4182
23 Jul 2015 11:51 AM
Use a remote function to interact with the datastore on the server.
Report Abuse
8BitDeveloping is not online. 8BitDeveloping
Joined: 09 Aug 2011
Total Posts: 1472
23 Jul 2015 12:20 PM
Thank you! Got it working.


i really really really wanna run over youuu
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image