I seriously have no clue how to explain this, but i don’t think this should be happening;
this is what happens:
that is infact NOT meant to happen
please don’t ignore this post because of the chunk of code i’m about to send
all of the functions in the module script have minimal differences
module:
local mPlaceService = game:GetService("MarketplaceService")
local gamepassID = 894310982
local lighting = game:GetService("Lighting")
local weatherPart = workspace:WaitForChild("LightingEditor"):WaitForChild("WeatherPart")
local weatherEmitter = weatherPart:WaitForChild("WeatherEmitter")
local weatherFunctions = {
DefaultButton = function()
weatherEmitter.Enabled = false
lighting.Atmosphere.Density = 0.3
lighting.Atmosphere.Offset = 0.25
lighting.Atmosphere.Haze = 0
lighting.Atmosphere.Color = Color3.new(199,199,199)
lighting.Atmosphere.Decay = Color3.new(106,112,125)
end,
RainButton = function()
local rainParticle = 3806149008
lighting.Atmosphere.Density = 0.449
lighting.Atmosphere.Offset = 0.25
lighting.Atmosphere.Color = Color3.new(255,255,255)
lighting.Atmosphere.Haze = 0.11
weatherEmitter.Enabled = true
weatherEmitter.Texture = "rbxassetid://" .. rainParticle
weatherEmitter.Speed = NumberRange.new(120,150)
weatherEmitter.Size = NumberSequence.new(3)
weatherEmitter.Rate = 2000
end,
SnowButton = function()
local snowParticle = 16400268732
lighting.Atmosphere.Density = 0.449
lighting.Atmosphere.Offset = 0.25
lighting.Atmosphere.Color = Color3.new(255,255,255)
lighting.Atmosphere.Haze = 0.11
weatherEmitter.Enabled = true
weatherEmitter.Texture = "rbxassetid://" .. snowParticle
weatherEmitter.Speed = NumberRange.new(10,30)
weatherEmitter.Size = NumberSequence.new(1)
weatherEmitter.Lifetime = NumberRange.new(10,15)
end,
CloseButton = function(frame: Frame)
frame.Visible = false
end,
}
local lightingModule = {}
function lightingModule.OnButtonClicked(frame: Frame, buttonClicked: TextButton)
local plr: Player = buttonClicked.Parent.Parent.Parent.Parent.Parent
if mPlaceService:UserOwnsGamePassAsync(plr.UserId, gamepassID) then
weatherFunctions[buttonClicked.Name](frame)
else
plr:Kick("Trying to bypass the gamepass? Nice try.") -- Easily bypassable by any exploiter with double digit IQ, will demolish script kiddies though.
end
end
return lightingModule
localscript (included the important parts only)
-- background is an image label that contains all of the buttons
-- mainFrame is the parent of the background
-- button is self-explanatory
for _,button in background:GetChildren() do -- Not using a for loop will not fix this;
if button:IsA("TextButton") then
button.MouseButton1Click:Connect(function()
if not mPlaceService:UserOwnsGamePassAsync(plr.UserId, gamepassID) then plr:Kick("Trying to bypass the gamepass? Nice try.") return end -- Easily bypassable, but destroys script kiddies.
lightingModule.OnButtonClicked(mainFrame, button)
end)
end
end