Hello there! I am having a bit of trouble trying to make a script for my game. I am very new to scripting and still am in the process of learning lua.
I am working on making a computer which the player can interact with. Currently, there are two screens that the computer can switch between. I am trying to find a way to make Screen 1 (Floppa) switch to Screen 2 (Bluescreen) when it is touched by the player. Here are the screens…
Screen 1 (Floppa)
Screen 2 (Bluescreen)
And here is everything you need to see in my workspace.
As you can see, I made two different parts for the screens. This is because both the Floppa and Bluescreen screens are a decal. Essentially, my hope was to keep things simple. I wanted to make two scripts where, when the first screen is touched, it turns transparent and the second screen becomes completely visible. Here is my code for Decal1 (Aka the Floppa picture):
local Screen = script.Parent.Parent -- screen in which the Floppa picture is on
local Floppa = script.Parent -- decal1 (the decal which is supposed to turn transparent on touch.)
Screen.Touched:connect(function()
Floppa.Transparency = 1
Screen.Transparency = 1 -- turned both the part for the screen and the decal1 transparent because i have two different parts for the screen.
end)
end
And for the Bluescreen, or Decal2:
local Screen = script.Parent.Parent -- the screen decal2 is on.
local BlueScreen = script.Parent -- decal2. this decal is supposed to become opaque.
Screen.Touched:connect(function()
BlueScreen.Transparency = 0
Screen.Transparency = 0 -- again, made them both opaque for the same reason as before, just to make things simpler
end)
end
I also wanted to make this change only visible to the player touching it, hence the local script instead of a regular script.
My scripts do not seem to work. There are no error messages or anything in the output feed, but nothing seems to happen when I touch Screen1.
If anyone could provide any help, guidance, point out errors, or even just give suggestions, that would be wonderful. I am still learning and only have a small general understanding of lua. Anything that you can share would be a huge help!
With love,
Mono