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

CurrentCamera and PlayerGui is changing for all players?

Asked by 6 years ago

I've recently noticed while making games that need things to change for a single player; it affects every player ingame. I'm not sure why this is happening since CurrentCamera and PlayerGui used to change for a single player. I'm not sure if I'm just scripting it differently, or if Roblox happened to send out an update that changed this.

A script I have here is meant to change only for a single player, and it changes text in the player's GUI. Instead of changing for a single player, it changes for every player.

01p = game.Players.LocalPlayer
02camera = workspace.CurrentCamera
03 
04playergui = game:GetService('Players').LocalPlayer:WaitForChild('PlayerGui')
05 
06local debounce = false
07 
08local text = "Test"
09gui = playergui.Texter
10 
11workspace.Stop.Touched:Connect(function()
12    if debounce == false then
13debounce = true
14    for i = 1,#text do
15        gui.TextLabel.Text = string.sub(text, 1, i)
View all 24 lines...

The script itself works fine, but whenever a player touches the Stop (a part in the workspace) the text "test" will appear on everyone's screen.

Another situation like this with CurrentCamera occurs. I have used CurrentCamera to change blur, color correction, and more.

This script snippet, which will supposedly change the player's screen to have a more green feel and darker tint works (with bugs), but displays these effects to every player's screen like stated with the PlayerGui problem.

1camera = workspace.CurrentCamera
2 
3            camera.correct.TintColor = Color3.fromRGB(125,143,123)
4            for i = 0, -.15, -.05 do
5                camera.correct.Brightness = i
6                wait()
7            end
8        end

With that being said, I hope that somebody can help me with this problem as it is a regular occurrence and annoyance. I appreciate any help that I can receive, have a good night/day. :)

0
wheres the script located GoldAngelInDisguise 297 — 6y
0
Is it possible to see more of the second script? Is it a script or a localscript? In which circumstances is that snippet ran? DevNetx 250 — 6y
0
It's in the StarterCharacterScripts. The second script is in a local script and is in the StarterCharacterScripts as well. The snippet is ran when a part is touched, it also changes a GUI's text which also isn't local. Like the answer you gave me, I believe the problem is with .Touched event.   CaptainAlien132 225 — 6y

1 answer

Log in to vote
1
Answered by
DevNetx 250 Moderation Voter
6 years ago

With your first script, the .Touched event will fire when any players touches the part. This means that whenever any player touched it, the event will fire on all clients.

You should check whether the part touching it is part of the local player's character, then continue with whatever it's doing.

Ad

Answer this question