1local player = game.Players.LocalPlayer
2local safePos = Vector3.new(6.89, 29.31, 103.79)
3local houses = workspace.Houses
4
5local function getHighestHouse()
6 local highest, highestNum = nil, 0
7 for _, house in houses:GetChildren() do
8 local num = tonumber(house.Name:match("%d+"))
9 if num and num > highestNum then
10 highestNum = num
11 highest = house
12 end
13 end
14 return highest
15end
16
17local knob = getHighestHouse().Door.Door.Knob
18local prompt
19
20for _, child in knob:GetChildren() do
21 if child:IsA("ProximityPrompt") and child.ObjectText == "Door" then
22 child.HoldDuration = 0
23 child.MaxActivationDistance = math.huge
24 child.RequiresLineOfSight = false
25 prompt = child
26 break
27 end
28end
29
30task.spawn(function()
31 while true do
32 local character = player.Character or player.CharacterAdded:Wait()
33 local root = character:WaitForChild("HumanoidRootPart")
34
35 root.CFrame = CFrame.new(knob.Position)
36 task.wait(0.05)
37 fireproximityprompt(prompt)
38 task.wait(0.2)
39
40 if player:GetAttribute("Gameing") then
41 root.CFrame = CFrame.new(safePos)
42 repeat task.wait(0.1) until not player:GetAttribute("Gameing")
43 end
44
45 task.wait(0.1)
46 end
47end)
Comments
…