My Tool works in Studio mode, but not in Online mode. Is there something wrong with my Script?
Asked by
8 years ago Edited 8 years ago
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
%%%%%%% LocalScript (LOCAL SCRIPT) %%%%%%%%%%
05 | selectionBox = Instance.new( "SelectionBox" ) |
06 | selectionBox.Color = BrickColor.Red() |
07 | selectionBox.Visible = true |
09 | selectionLasso = Instance.new( "SelectionPartLasso" ) |
10 | selectionLasso.Color = BrickColor.Black() |
11 | selectionLasso.Humanoid = game.Players.LocalPlayer.Character.Humanoid |
13 | gui = Instance.new( "ScreenGui" ) |
14 | text = Instance.new( "TextLabel" ) |
16 | text.Text = "No brick selected" |
17 | text.BackgroundColor 3 = Color 3. new( 1 / 256 * 17 , 1 / 256 * 17 , 1 / 256 * 17 ) |
18 | text.BorderColor 3 = Color 3. new( 1 / 256 * 17 , 1 / 256 * 17 , 1 / 256 * 17 ) |
19 | text.TextColor 3 = Color 3. new( 1 , 1 , 1 ) |
20 | text.Position = UDim 2. new( 0 , 0 , 1 , - 20 ) |
21 | text.Size = UDim 2. new( 0 , 100 , 0 , 20 ) |
22 | text.BackgroundTransparency = 0.25 |
24 | function onMouseButton 1 Down(target) |
26 | if target:FindFirstChild( "Value" ) ~ = nil then |
27 | if target.Locked = = true then |
29 | target.Velocity = Vector 3. new( 0 , 0 , 0 ) |
30 | target.RotVelocity = Vector 3. new( 0 , 0 , 0 ) |
31 | selectionBox.Color = BrickColor.Green() |
32 | text.Text = "Brick is Locked" |
35 | target.Velocity = Vector 3. new( 0 , 0 , 0 ) |
36 | target.RotVelocity = Vector 3. new( 0 , 0 , 0 ) |
37 | selectionBox.Color = BrickColor.Red() |
38 | text.Text = "Brick isn't Locked" |
44 | function onMouseMoved(target) |
46 | if target:FindFirstChild( "Value" ) ~ = nil then |
47 | if target.Locked = = false then |
48 | selectionBox.Adornee = target |
49 | selectionBox.Color = BrickColor.Red() |
50 | selectionLasso.Part = target |
52 | target.Velocity = Vector 3. new( 0 , 0 , 0 ) |
53 | target.RotVelocity = Vector 3. new( 0 , 0 , 0 ) |
54 | selectionBox.Color = BrickColor.Red() |
55 | text.Text = "Brick isn't Locked" |
57 | selectionBox.Adornee = target |
58 | selectionBox.Color = BrickColor.Green() |
59 | selectionLasso.Part = target |
61 | target.Velocity = Vector 3. new( 0 , 0 , 0 ) |
62 | target.RotVelocity = Vector 3. new( 0 , 0 , 0 ) |
63 | selectionBox.Color = BrickColor.Green() |
64 | text.Text = "Brick is Locked" |
67 | selectionBox.Adornee = nil |
68 | selectionLasso.Part = nil |
69 | text.Text = "Brick is Protected" |
72 | selectionBox.Adornee = nil |
73 | selectionLasso.Part = nil |
74 | text.Text = "Brick is Protected" |
78 | function onSelected(mouse) |
79 | if active = = false then |
81 | gui.Parent = game.Players.LocalPlayer.PlayerGui |
82 | selectionBox.Parent = game.Players.LocalPlayer.PlayerGui |
83 | selectionLasso.Parent = game.Players.LocalPlayer.PlayerGui |
84 | mouse.Move:connect( function () onMouseMoved(mouse.Target) end ) |
85 | mouse.Button 1 Down:connect( function () onMouseButton 1 Down(mouse.Target) end ) |
89 | function onDeselected() |
90 | if active = = true then |
93 | selectionBox.Parent = nil |
94 | selectionLasso.Parent = nil |
98 | script.Parent.Selected:connect(onSelected) |
99 | script.Parent.Deselected:connect(onDeselected) |
%%%%%%%%% LockScript (SCRIPT) %%%%%%%%%%%%
04 | coroutine.resume(coroutine.create(func)) |
07 | function makeMessage(text, time) |
10 | local ply = bin.Parent.Parent |
12 | local m = Instance.new( "Message" ) |
13 | m.Name = "LockToolMessage" |
22 | function onButton 1 Down(mouse) |
24 | if target:FindFirstChild( "Value" ) = = 0 then |
25 | makeMessage( "Protected Part" , 3 ) |
27 | if target:FindFirstChild( "Value" ) ~ = nil then |
30 | makeMessage( "Unlocked \"" .. target.Name .. "\"" , 3 ) |
33 | makeMessage( "Locked \"" .. target.Name .. "\"" , 3 ) |
39 | function onSelected(mouse) |
41 | mouse.Button 1 Down:connect( function () onButton 1 Down(mouse) end ) |
44 | bin.Selected:connect(onSelected) |