Heya! So i have this game, where there are two areas (Outside, Inside), and outside i want there to be snowfall, im using a Part with a particle emitter in it that locks to the camera to simulate snow.
there are two parts near the exit that tells a player script whether they are inside or outside… now this does work, for the most part, but the problem is, some player models either lag or full on freeze when going through the parts, Im not entirely sure why this is the case and ive tried a few things but nothing has seemed to work so far, i also have a fog script (thats seperate from the snow script) that works pretty much the same but puts an atmosphere into lighting, but it doesnt lag at all.
heres an example of the problem
here’s the Script:
local lighting = game:GetService("Lighting")
task.wait(2)
local outside = workspace["Fog changes"]["Fog change outside"]
local inside = workspace["Fog changes"]["Fog change inside"]
local player = game.Players.LocalPlayer
local function snow()
if player.Character:FindFirstChild("Snow emitta") then
player.Character["Snow emitta"]:Destroy()
player.PlayerScripts["locked to cam"]:destroy()
end
local snow = game.ReplicatedStorage["Snow emitta"]:Clone()
snow.Parent = player.Character
snow["locked to cam"].Parent = player.PlayerScripts
task.wait(0.3)
player.PlayerScripts["locked to cam"].Enabled = true
end
local function nosnow()
if player.Character:FindFirstChild("Snow emitta") then
player.Character["Snow emitta"]:Destroy()
player.PlayerScripts["locked to cam"]:destroy()
end
end
outside.Touched:Connect(function(touch)
if touch.Parent:FindFirstChildOfClass("Humanoid") then
snow()
end
end)
inside.Touched:Connect(function(touch)
if touch.Parent:FindFirstChildOfClass("Humanoid") then
nosnow()
end
end)
and also the locked to camera script if its needed
local RunService = game:GetService("RunService")
local player = game.Players.LocalPlayer.Character
local SnowPart = player["Snow emitta"]["Snow thing"]
local Cam = workspace.CurrentCamera
local Offset = Vector3.new(0, 10, 0)
RunService.RenderStepped:Connect(function(dt)
SnowPart.Position = Cam.CFrame.Position + Offset
end)