Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Works fine in studio but not online? (remoteevents)

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 comments

2

You can't access the ServerStorage from a local script. Put CameraCFrame in the ReplicatedStorage instead.

0

Try putting the RemoteEvents in Workspace instead of ReplicatedStorage, and don't try to access ServerStorage from a LocalScript.

1 answer

✓ Accepted answer

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.