Script Not Working

Hey Developers!

I am making a game similar to “get a snack at 4am” and for one of my endings I need the script to enable a ColorCorrection and a Typewriter GUI if you have a Witch Brew and try to leave the store, but it won’t work.

Here is my script:

	local plr = game.Players.GetPlayerFromCharacter(hit.Parent)
	if hit and plr.BloxyCola or plr.WitchBrew then
	game.Lighting.ColorCorrection.Enabled = true
		game.StarterGui.typewriterGUI.Enabled = true
		end
end)

Thanks!

For the gui instead of game.StarterGui your supposed to do

plr.PlayerGui.typewriterGUI.Enabled = true

Everything in the starter gui gets replicated into the players player gui thats why you weren’t able to see the gui the way you did it because they don’t see what’s in the starter gui

1 Like

Thanks! But the ColorCorrection still doesn’t work.

Sorry I don’t really know about lighting but at least I got the GUI working for you!

It doesn’t work. What should I do now?

Are you getting any errors or does it just not do anything?

No errors. Just doesn’t do anything.

I think a little bit of the issue might the fact that Lighting is a service, not a property of the game.
Try:

	local plr = game.Players.GetPlayerFromCharacter(hit.Parent)
	if hit and plr.BloxyCola or plr.WitchBrew then
	game:GetService("Lighting").ColorCorrection.Enabled = true
		game.StarterGui.typewriterGUI.Enabled = true
		end
end)

It would be:

local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
	if hit and plr.BloxyCola or plr.WitchBrew then
	game:GetService("Lighting").ColorCorrection.Enabled = true
		plr.PlayerGui.typewriterGUI.Enabled = true
		end
end)

I don’t know if this is causing the problem but it’s supposed to be:

game.Players:GetPlayerFromCharacter()

Instead of:

game.Players.GetPlayerFromCharacter()
1 Like

are u doing this from a server script or a local script

Yes I just copied his script because I’m pretty sure that block of code is inside a greater function, so it’d be indented

My guess is server because he didn’t use local player and it looks like a touched event

I was talking about adding the plr.PlayerGui not about the indenting

1 Like

Yeah. A Normal script inside ServerScriptService.

Oh my bad I overlooked that, yes you’re right

do u already have a colorcorrection object inside lighting

Yeah. I already put that in Lighting.

can u check the explorer when your script executes and check if it becomes enabled

@EqualAxoly did this work?

character limit :coefficients: