I created a script in a part and I scripted this:
01 | triggername = "FogTrigger2" |
02 |
03 | function onTouched(part) |
04 | if part.Parent ~ = nil then |
05 | local h = part.Parent:findFirstChild( "Humanoid" ) |
06 | if h~ = nil then |
07 | local teleportfrom = script.Parent.Enabled.Value |
08 | if teleportfrom~ = 0 then |
09 | local lightning = game.Lighting |
10 | lightning.FogColor = Color 3. fromRGB( 193 , 184 , 115 ) |
11 | lightning.FogEnd = 100 |
12 | else |
13 | print ( "Could not find the trigger" ) |
14 | end |
15 | end |
16 | end |
17 | end |
18 |
19 | script.Parent.Touched:connect(onTouched) |
Now how to do it works only for Local Player? I enabled Filtered Enabled and isn't working. Thanks.
You can use a remote event. Or even a local script.
It's easier to use a LocalScript. Simply put it somewhere that it will execute and copy that exact code. Just change the last line:
1 | local Part = game.Workspace.Part -- CHANGE THIS |
2 | Part.Touched:connect( function (part) |
3 | if part.Parent.Name = = game.Players.LocalPlayer.Name then |
4 | onTouched(part) |
5 | end |
6 | end ) |
Haven't test code. Let me know if there's errors.
1 | local part = game.Workspace.INSERT PART NAME HERE |
2 | part.Touched:Connect( function () |
3 |
4 | end ) |
you can clone your smoke each time, and replace the function with my code.