Trying to make a private base for myself?
I'm trying to make a private base for myself, and others with this script, but it doesn't work.
001 | local nam = "xTranquil's private base" |
002 | people = { "xTranquil" } |
009 | local stringk = str:lower() |
010 | for _, v in pairs (game.Players:getPlayers()) do |
011 | if string.lower(string.sub(v.Name, 1 ,#stringk)) = = stringk then |
017 | function FindTab(var, tab) |
019 | for i,v in pairs (tab) do |
027 | function prop(part, parent, collide, tran, ref, x, y, z, color, anchor, form) |
029 | part.formFactor = form |
030 | part.CanCollide = collide |
031 | part.Transparency = tran |
032 | part.Reflectance = ref |
033 | part.Size = Vector 3. new(x,y,z) |
034 | part.BrickColor = BrickColor.new(color) |
036 | part.BottomSurface = 0 |
037 | part.Anchored = anchor |
043 | pcall ( function () workspace [ nam ] :remove() end ) |
045 | local size = Vector 3. new( 512 , 1 , 512 ) |
046 | local mod = Instance.new( "Model" ,workspace) |
048 | local ba = Instance.new( "Part" ) |
049 | prop(ba,mod, true , 0 , 0 ,siz.X,siz.Y,siz.Z, "Dark green" , true , "Custom" ) |
050 | ba.CFrame = CFrame.new( 0 , 0 , 0 ) * CFrame.new(siz.X* 4 , 0 , 0 ) |
051 | ba.TopSurface = "Studs" |
053 | local wall = Instance.new( "Part" ) |
054 | prop(wall,mod, true , 0.4 , 0 ,siz.X,siz.X/ 2 , 2 , "Bright violet" , true , "Custom" ) |
055 | wall.CFrame = ba.CFrame * CFrame.Angles( 0 ,math.rad(i), 0 ) * CFrame.new( 0 ,wall.Size.Y/ 2 ,siz.Z/ 2 ) |
056 | table.insert(walls,wall) |
058 | local roof = Instance.new( "Part" ) |
059 | prop(roof,mod, true , 0.4 , 0 ,siz.X, 2 ,siz.Z, "Bright violet" , true , "Custom" ) |
060 | roof.CFrame = ba.CFrame * CFrame.new( 0 ,siz.X/ 2 , 0 ) |
061 | table.insert(walls,roof) |
068 | function chat(msg,recipient,speaker) |
069 | if string.sub(msg, 1 , 4 ) = = "col/" then |
070 | base.BrickColor = BrickColor.new(string.sub(msg, 5 )) |
071 | for _,v in pairs (walls) do |
072 | v.BrickColor = BrickColor.new(string.sub(msg, 5 )) |
074 | elseif string.sub(msg, 1 , 5 ) = = "tran/" then |
075 | base.Transparency = string.sub(msg, 6 ) |
076 | for _,v in pairs (walls) do |
077 | v.Transparency = string.sub(msg, 6 ) + 0.4 |
079 | elseif string.sub(msg, 1 , 4 ) = = "ref/" then |
080 | base.Reflectance = string.sub(msg, 5 ) |
081 | for _,v in pairs (walls) do |
082 | v.Reflectance = string.sub(msg, 5 ) |
084 | elseif string.sub(msg, 1 , 3 ) = = "in/" then |
085 | local player = findplr(string.sub(msg, 4 )) |
086 | if player ~ = nil then |
087 | if player.Character ~ = nil then |
088 | player.Character:MoveTo(base.Position + Vector 3. new(math.random(- 20 , 20 ), 3 ,math.random(- 20 , 20 ))) |
091 | elseif string.sub(msg, 1 , 4 ) = = "out/" then |
092 | local player = findplr(string.sub(msg, 5 )) |
093 | if player ~ = nil then |
094 | if player.Character ~ = nil then |
095 | player.Character:MoveTo(Vector 3. new(math.random(- 20 , 20 ), 3 ,math.random(- 20 , 20 ))) |
101 | for _,v in pairs (game.Players:GetPlayers()) do |
103 | for _,k in pairs (people) do |
104 | if v.Name:lower() = = k:lower() then |
109 | v.Chatted:connect(chat) |
110 | v.CharacterAdded:connect( function (char) |
113 | char:MoveTo(base.Position + Vector 3. new(math.random(- 20 , 20 ), 3 ,math.random(- 20 , 20 ))) |
119 | game.Players.PlayerAdded:connect( function (plr) |
121 | for _,k in pairs (people) do |
122 | if plr.Name:lower() = = k:lower() then |
127 | plr.Chatted:connect(chat) |
128 | plr.CharacterAdded:connect( function (char) |
131 | char:MoveTo(base.Position + Vector 3. new(math.random(- 20 , 20 ), 3 ,math.random(- 20 , 20 ))) |
140 | if prop = = "Parent" then |
143 | model.Changed:connect(change) |
144 | base.Changed:connect(change) |
148 | model.Changed:connect(change) |
But this is the error I get.
LUA ERROR: [string "local player = game.Players.LocalPlayer..."]:5: attempt to index field 'Hit' (a userdata value)