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

Why when i clone a "ColorCorrelation" into a player camera it only works server side?

Hello, im making a horror game and i've made it so the "Beast" will get a Night vision on spawn. This works totally fine in Test mode but when i go to test the game with a local server i notice the night vision gets cloned into the servers Camera and not the local players camera. as shown here: https://gyazo.com/21921874db13b245d8f64cada2f7116a -- Player View https://gyazo.com/d7e77266bdaba6e666518dec37f86ad1 -- Server View

My instant thinking was to make a local script to do this but then soon realised that i only want this to happen when a a player is on the "Beast" team and players will end up switching teams over time e.g: Lobby, Civilian and Beast.

If anyone knows how to fix this please let me know. Thankyou

1 comment

1

i think you should use FilteringEnabled instead, and store it in Lighting though, it will be only visible to the player and not the other clients & server

1 answer

✓ Accepted answer

OOH HOLY REMOTEEVENT, HERE I COME AGAIN!

Hello! Good luck with your project!

To do what you want to do, you will need a RemoteEvent, and also have FilteringEnabled true. If more of your scripts gets broken because of FilteringEnabled, do not worry, just come here and ask! FilteringEnabled is a very important feature.

So, you have a RemoteEvent? Good. Place it to ReplicatedStorage. It's a place where both local and server can reach.

Now name it "BeastModeEnable"

Good! Next thing you need to do is to fire this RemoteEvent for only the beast! Let's say you picked the beast randomly from the player list inside a ServerScript(Normal Script).

local AllPlayers = game.Players:GetChildren()
local Beast = AllPlayers[math.random(#AllPlayers)]

Now we fire the remoteevent. To fire it, we will need FireClient function of it, and also beast player as first parameter, and of course you do this from ServerScript.

game.ReplicatedStorage.BeastModeEnable:FireClient(Beast)

Alright we are done for server! Now get to a LocalScript, preferably inside StarterPlayerScripts. Wait for RemoteEvent, and use Nightvision code of yours!

local Camera = game.Workspace.CurrentCamera --To get camera of player. Only works in LocalScript.

game.ReplicatedStorage.BeastModeEnable.OnClientEvent:Connect(function()
	--Nightvision code of yours. Place it into Camera variable we just assigned.
end)

Please upvote and accept as an answer if it helped! Please write comment if you are stuck somewhere so we can help =)

1 comment

1

Thanks

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