I’m currently trying to make a scope that has a reticle, and I want the reticle to change at night to turn into green.
I already have the texture of the Night reticle, I just need to find a way to actually make it work.
This part is a child of a model, which shouldn’t affect much.
TLDR: I want to make a decal change color at night, I have the texture made and I just need a way to do the script. Any concept would be nice so I can piece together the script.
Have a script that checks the value in Lighting, for Minutes
if Minutes is < a certain value and > than a certaint value, then its day
otherwise its night
apply the decal depending on which one of these it is
local dawn = 360
local evening = 1200
local lastState = ""
while true do
local minutes = game.Lighting:GetMinutesAfterMidnight()
if minutes > dawn and minutes < evening then --its day
if lastState ~= "day" then
--change decal to day
lastState = "day"
end
else --its night
if lastState ~= "night" then
--change decal to night
lastState = "night"
end
end
wait(1)
end
--18/6 = night
--any other time = day
--used geographiclatitude = 28.244
local Reticle = script.Parent.Decal
local Reticle2 = script.Parent.Parent.Reticle2.Decal
if game.Lighting.ClockTime >= 18 then
Reticle.Transparency = 1
Reticle2.Transparency = 0
end
if game.Lighting.ClockTime < 18 then
Reticle.Transparency = 0
Reticle2.Transparency = 1
end
I tried doing something like this due to @Scottifly’s suggestion and it has no errors with output but it just doesn’t change the transparency at all. Any reason it wouldn’t?
It was due to the day and cycle night script I was using. It works now. Thanks for the help mates!
The gun the player is using should be stored in the Player’s backpack (or however the ACS gun engine does it) while playing, so you can’t reference that model in replicated storage.
Your script has to reference the actual gun model the player is using, not where it was cloned from.
ACS works by adding a tool to your backpack and has set animations and rules/options of the gun. The gun model itself is located in ReplicatedStorage, not in the player model which is server sided meaning it doesn’t show in the view model just other players.
So as @SelDraken said, you have to find out exactly where the gun model is a child of your player. Your script has to reference that location.
Remember that your local player is parented to the workspace, not the Player Service folder.
Ah I get what you mean,
that is already done by putting the script in ReplicatedStorage. Due to ACS being weird, it doesn’t update till you reequip after moving a part or making any changes (manually at least). But with the script, it doesn’t show either way.
It seems to work for the server, but the viewmodel doesn’t change.
Found the location of viewmodel (camera), it actively changes when I manually do it. But the script decides to not work for god knows what reason. No output errors.