|
| 17 Jul 2014 02:26 AM |
When i go though the Game pass door in my place, I end up teleporting @ the top of my lobby...Does anyone know why this i happonding and also the script was found on a wiki page, Because Game Pass door's are kinda new to me...
|
|
|
| Report Abuse |
|
|
|
| 17 Jul 2014 02:26 AM |
| do we look like scripting helpers subforum |
|
|
| Report Abuse |
|
|
|
| 17 Jul 2014 02:26 AM |
woo more idiots for OT to bash.
- obsession is an art - (add 25k posts to ocd) |
|
|
| Report Abuse |
|
|
| |
|
Stuff1646
|
  |
| Joined: 22 Dec 2012 |
| Total Posts: 81 |
|
|
| 17 Jul 2014 02:29 AM |
Have you tried this: ------------------------------------------ --| Stuff1646 demands better hammers XDD |-- ------------------------------------------
-- Waits for parent.child to exist, then returns it local function WaitForChild(parent, childName) assert(parent, "ERROR: WaitForChild: parent is nil") while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end return parent[childName] end
----------------- --| Variables |-- -----------------
local GamePassService = Game:GetService('GamePassService') local PlayersService = Game:GetService('Players')
local VipDoor = script.Parent
local GamePassIdObject = WaitForChild(script, 'GamePassId')
local JustTouched = {}
----------------- --| Functions |-- -----------------
-- Finds out which side the player is on and teleports them to the other local function TeleportToOtherSide(character, hitPart) local bottomOfDoor = VipDoor.CFrame.p - Vector3.new(0, VipDoor.Size.Y / 2, 0) local inFrontOfDoor = bottomOfDoor + VipDoor.CFrame.lookVector * 3 local behindDoor = bottomOfDoor - VipDoor.CFrame.lookVector * 3 local distanceToFront = (inFrontOfDoor - hitPart.Position).magnitude local distanceToBack = (behindDoor - hitPart.Position).magnitude if distanceToFront < distanceToBack then character:MoveTo(behindDoor) else character:MoveTo(inFrontOfDoor) end end
-- When a player with the game pass touches the door, teleport them to the other side local function OnTouched(otherPart) if otherPart and otherPart.Parent and otherPart.Parent:FindFirstChild('Humanoid') then local player = PlayersService:GetPlayerFromCharacter(otherPart.Parent) if player and not JustTouched[player] then JustTouched[player] = time() if GamePassService:PlayerHasPass(player, GamePassIdObject.Value) then TeleportToOtherSide(player.Character, otherPart) end end end end
-- Removes old entries in JustTouched local function RemoveOldTouches() for player, touchTime in pairs(JustTouched) do if time() > touchTime + 0.3 then JustTouched[player] = nil end end end
-------------------- --| Script Logic |-- --------------------
VipDoor.Touched:connect(OnTouched)
while true do RemoveOldTouches() wait(1/30) end
Create a vaule saying the Gamepassid
|
|
|
| Report Abuse |
|
|
wazap
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 23234 |
|
|
| 17 Jul 2014 02:29 AM |
put repeat until game:FindFirstChild("SubScript12") on line 12 |
|
|
| Report Abuse |
|
|
|
| 17 Jul 2014 02:30 AM |
| Sounds really good script, I'll try it.. |
|
|
| Report Abuse |
|
|
|
| 17 Jul 2014 02:30 AM |
what the hell, how'd a SC get in here
- obsession is an art - (add 25k posts to ocd) |
|
|
| Report Abuse |
|
|
|
| 17 Jul 2014 02:34 AM |
@ Stuff1646 Doesn't work... |
|
|
| Report Abuse |
|
|
Stuff1646
|
  |
| Joined: 22 Dec 2012 |
| Total Posts: 81 |
|
|
| 17 Jul 2014 02:35 AM |
Try This: Players = game:GetService("Players") Lighting = game:GetService("Lighting") GamePass = game:GetService("GamePassService")
PassId =
local debounce = false
script.Parent.Touched:connect(function(hit) if hit.Parent:findFirstChild("Humanoid") and debounce == false then debounce = true player = Players:GetPlayerFromCharacter(hit.Parent) if GamePass:PlayerHasPass(player, PassId) then script.Parent.Transparency = .5 script.Parent.CanCollide = false wait(5) script.Parent.Transparency = 0 script.Parent.CanCollide = true else player.Character:BreakJoints() end wait(2) debounce = false end end)
Above should work has i used it before... |
|
|
| Report Abuse |
|
|
|
| 17 Jul 2014 02:38 AM |
HURRAY !! It works...The door opens and if you hav'nt got the pass then it kills the player !
Thank You !
|
|
|
| Report Abuse |
|
|
Stuff1646
|
  |
| Joined: 22 Dec 2012 |
| Total Posts: 81 |
|
| |
|