Answered by
6 years ago Edited 6 years ago
We live in FilteringEnabled times. That is client can not manipulate shared workspace, other than through moving his character, remote events and/or remote functions...
Change your script to localScript and edit like this:
1 | local ReplicatedStorage = game:GetService( "ReplicatedStorage" ) |
2 | local PrisonCellOpenRequest = ReplicatedStorage:WaitForChild( "PrisonCellOpenRequest" ) |
5 | script.Parent.MouseButton 1 Click:Connect( function () |
6 | print ( "Button1 Clicked" ) |
7 | local result = PrisonCellOpenRequest:InvokeServer() |
Then add this script to a ServerScriptStorage:
01 | local ReplicatedStorage = game:GetService( "ReplicatedStorage" ) |
02 | local PrisonCellOpenRequest = Instance.new( "RemoteFunction" ) |
03 | PrisonCellOpenRequest.Parent = ReplicatedStorage |
04 | PrisonCellOpenRequest.Name = "PrisonCellOpenRequest" |
06 | local function onPrisonCellOpenRequest(player) |
09 | workspace.PrisonCell.Door.Bar 1. Anchored = false |
10 | workspace.PrisonCell.Door.Bar 2. Anchored = false |
11 | workspace.PrisonCell.Door.Bar 3. Anchored = false |
12 | workspace.PrisonCell.Door.Bar 4. Anchored = false |
13 | workspace.PrisonCell.Door.Bar 5. Anchored = false |
14 | workspace.PrisonCell.Door.Bar 6. Anchored = false |
15 | workspace.PrisonCell.Door.Main.Disabled = true |
20 | PrisonCellOpenRequest.OnServerInvoke = onPrisonCellOpenRequest |
Edit: Changed connect to Connect