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
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Please Check my Script. It is for Universes.

Previous Thread :: Next Thread 
Boutonniere is not online. Boutonniere
Joined: 23 Jun 2011
Total Posts: 455
12 May 2014 05:38 PM
game:GetService('TeleportService').CustomizedTeleportUI = true

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

local Trigger = script.Parent

-- debouncer that prevents multiple trigger events by the player who is standing nearby.
function debounce(func)
local isRunning = false
return function(...)
if not isRunning then
isRunning = true
func(...)
isRunning = false
end
end
end

function getPlayer(Part)
local Humanoid = Part.Parent:FindFirstChild('Humanoid')
if (Humanoid ~= nil) then
local Character = Humanoid.Parent
if (Character ~= nil) then
return game:GetService('Players'):GetPlayerFromCharacter(Character)
end
end
end

function _sendPlayerToBuildZone(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('Building zone 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(_sendPlayerToBuildZone)

-- Touch event function
function onTouch(Source)
local player = getPlayer(Source)
if player then
if player.userId > 0 then
sendPlayerToBuildZone(player)
end
end
end

Trigger.Touched:connect(onTouch)
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
If you look at the line newPlaceId = game:CreatePlace('Building zone for ' .. playerIdentity, 92697995), you will notice that this lobby uses the place with ID 92697995 to create personal player zones. Is that correct, though?
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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