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

when you touch a brick the fogend changes to x number, how i can do that?

I want to know when you touch a block the fog changes to x number But I don't know much about scripting Someone can teach me how?

1 answer

If you want it to only change for the player that touches, you would put this in a localscript in somewhere like StarterGui if you have FilteringEnabled:

workspace["BrickNameHere"].Touched:Connect(function(hit)
	if hit.Parent == game.Players.LocalPlayer.Character then
		game.Lighting.FogEnd = 10 --change to new fogend
	end
end)

Otherwise, if you want the fog to change for everyone, you can do something like this in a normal script inside the part:

script.Parent.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		game.Lighting.FogEnd = 10 --change to new fogend
	end
end)

2 comments

0

Thanks so much!

0

Why didn't you accept his answer.

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