As the title said, I need help to configure these scripts to work "online"... I have tryied many things, but nothing worked, that is why I'm here. Please, give me a hand :D
The following scripts are a LOCK TOOL that verifies if the selected part have a IntValue of 1, then change it to locked or unlocked. Its working on Studio with no error reports on output. It just wont work at online... :(
*Representation in StarterPack
-LockTool --> (HopperBin) -LockScript -->(Script) -LocalScript -->(LocalScript)
%%%%%%% LocalScript (LOCAL SCRIPT) %%%%%%%%%%
wait(0.1) active = false selectionBox = Instance.new("SelectionBox") selectionBox.Color = BrickColor.Red() selectionBox.Visible = true selectionLasso = Instance.new("SelectionPartLasso") selectionLasso.Color = BrickColor.Black() selectionLasso.Humanoid = game.Players.LocalPlayer.Character.Humanoid gui = Instance.new("ScreenGui") text = Instance.new("TextLabel") text.Parent = gui text.Text = "No brick selected" text.BackgroundColor3 = Color3.new(1/256*17, 1/256*17, 1/256*17) text.BorderColor3 = Color3.new(1/256*17, 1/256*17, 1/256*17) text.TextColor3 = Color3.new(1, 1, 1) text.Position = UDim2.new(0, 0, 1, -20) text.Size = UDim2.new(0, 100, 0, 20) text.BackgroundTransparency = 0.25 function onMouseButton1Down(target) if target ~= nil then if target:FindFirstChild("Value") ~= nil then if target.Locked == true then target.Locked = true target.Velocity = Vector3.new(0, 0, 0) target.RotVelocity = Vector3.new(0, 0, 0) selectionBox.Color = BrickColor.Green() text.Text = "Brick is Locked" else target.Locked = false target.Velocity = Vector3.new(0, 0, 0) target.RotVelocity = Vector3.new(0, 0, 0) selectionBox.Color = BrickColor.Red() text.Text = "Brick isn't Locked" end end end end function onMouseMoved(target) if target ~= nil then if target:FindFirstChild("Value") ~= nil then if target.Locked == false then selectionBox.Adornee = target selectionBox.Color = BrickColor.Red() selectionLasso.Part = target target.Locked = false target.Velocity = Vector3.new(0, 0, 0) target.RotVelocity = Vector3.new(0, 0, 0) selectionBox.Color = BrickColor.Red() text.Text = "Brick isn't Locked" else selectionBox.Adornee = target selectionBox.Color = BrickColor.Green() selectionLasso.Part = target target.Locked = true target.Velocity = Vector3.new(0, 0, 0) target.RotVelocity = Vector3.new(0, 0, 0) selectionBox.Color = BrickColor.Green() text.Text = "Brick is Locked" end else selectionBox.Adornee = nil selectionLasso.Part = nil text.Text = "Brick is Protected" end else selectionBox.Adornee = nil selectionLasso.Part = nil text.Text = "Brick is Protected" end end function onSelected(mouse) if active == false then active = true gui.Parent = game.Players.LocalPlayer.PlayerGui selectionBox.Parent = game.Players.LocalPlayer.PlayerGui selectionLasso.Parent = game.Players.LocalPlayer.PlayerGui mouse.Move:connect(function() onMouseMoved(mouse.Target) end) mouse.Button1Down:connect(function() onMouseButton1Down(mouse.Target) end) end end function onDeselected() if active == true then active = false gui.Parent = nil selectionBox.Parent = nil selectionLasso.Parent = nil end end script.Parent.Selected:connect(onSelected) script.Parent.Deselected:connect(onDeselected)
%%%%%%%%% LockScript (SCRIPT) %%%%%%%%%%%%
bin = script.Parent function thread(func) coroutine.resume(coroutine.create(func)) end function makeMessage(text, time) print("msg") thread(function() local ply = bin.Parent.Parent if ply then local m = Instance.new("Message") m.Name = "LockToolMessage" m.Text = text m.Parent = ply wait(time) m.Parent = nil end end) end function onButton1Down(mouse) target = mouse.Target if target:FindFirstChild("Value") == 0 then makeMessage("Protected Part", 3) else if target:FindFirstChild("Value") ~= nil then if target.Locked then target.Locked = false makeMessage("Unlocked \"" .. target.Name .. "\"",3) else target.Locked = true makeMessage("Locked \"" .. target.Name .. "\"",3) end end end end function onSelected(mouse) mouse.Icon = "rbxasset://textures\\GunCursor.png" mouse.Button1Down:connect(function() onButton1Down(mouse) end) end bin.Selected:connect(onSelected)
Try and change the LockScript to Local script and see if that works qq
(Sorry im a noob in Lua)