Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Works fine in studio but not online? (remoteevents)

Asked by 6 years ago

server script

local CD = script.Parent
cameraA = game.ReplicatedStorage.cameraA
stop = false
O1 = script.Parent.Open
O2 = script

CD.MouseClick:connect(function(click)
    print("clicked by",click)
    local char = click.Character
        if stop == false and char:FindFirstChild("Humanoid") then
    print("running")
            local Player = click
            cameraA:FireClient(Player)
            stop = true
            wait()
            O1.Disabled = false
            O2.Disabled = true
    end
end)

local script

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:wait()
local Camera = workspace.CurrentCamera
local cameraA = ReplicatedStorage:WaitForChild("cameraA")
local CF = game.ServerStorage.CameraCFrame
convTime = workspace.Settings.ConversationTime.Value

cameraA.OnClientEvent:connect(function()
    Camera.CameraType = Enum.CameraType.Scriptable
    Camera.CFrame = CF.CFrame
    wait(convTime)
    Camera.CameraSubject = Player.Character.Humanoid
    Camera.CameraType = Enum.CameraType.Custom
end)

It should work fine, I don't get any errors... it just doesn't work

2
You can't access the ServerStorage from a local script. Put CameraCFrame in the ReplicatedStorage instead. UgOsMiLy 1074 — 6y
0
Try putting the RemoteEvents in Workspace instead of ReplicatedStorage, and don't try to access ServerStorage from a LocalScript. RiftTalon 98 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

Server Storage can not be accessed from a local script, only replicated storage or something related to a player can be accessed by them. If you put the Camera CFrame in replicated storage, the value is "Replicated" into the client and server "Storage", hence the name "Replicated Storage". Hope I helped.

Ad

Answer this question