Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

When part touched, gui pops up and gui text color changes?

Asked by 2 years ago

Context: I am making a horror game. There will be a task bar/mission thingie on the top right. When a player touches an invisible, cant collide part, the mission changes. It glitches and says something. then after a bit of "glitching" it turns back to normal.

Problem:

Well... I dont really know. I have triple checked every variable is correct (leads to the correct spot), and there are no errors in the script and in output. I tried putting "print("Done!")" at the ned, and the print doesn't print into output, which is proof is crewed up somewhere. Thanks in advance, any help is appreciated.

Script: links to images of my code and stuff: https://ibb.co/ZXrxmbB | https://ibb.co/xj5Jd87 | https://ibb.co/tqC6RdW | for the last image: on the top right it should not say "Go into the faculty room" and instead be glitchy and say "Go into the closet" before going back to normal

local screengui = game.StarterGui.Missions
local frame = screengui.Frame
local glitch1 = frame.Image
local glitch2 = glitch1.ImageLabel
local glitch3 = frame.ImageLabel
local glitch4 = glitch3.ImageLabel
local glitch5 = glitch4.ImageLabel
local all1 = glitch1 and glitch2
local all2 = glitch3 and glitch4 and glitch5
local all = all1 and all2
local changer = script.Parent
local colorgreen = Color3.new(0.113176, 0.655909, 0.0112764)
local colorred = Color3.new(0.985977, 0, 0.0269932)
local colorblack = Color3.new(0, 0, 0)
local colorblue = Color3.new(0, 0, 0.998184)
local colorwhite = Color3.new(1,1,1)
local debounce = false
local text = frame.Text
all.Visible = false
script.Parent.Touched:Connect(function(hit)
    if hit.Parent:FindFirstChild("Humanoid") == true and debounce == false then
        debounce = true 
        text.TextColor3 = colorred
        text.Text = ("Go into the closet")
        wait(0.3)
        text.TextColor3 = colorgreen
        all1.Visible = true
        text.Text = ("g0 iNTo tHE clOSEt")
        wait(0.09)
        text.TextColor3 = colorblack
        all1.Visible = false
        all2.Visible = true
        wait(0.1)
        all2.Visible = false
        text.TextColor3 = colorwhite
        text.Text = ("GOINTOTHECLOSET")
        wait(0.5)
        text.TextColor3 = colorblack
        wait(0.2)
        text.TextColor3 = colorwhite
        all.Visible = true
        wait(0.13)
        all.Visible = false
        print("Done!")
    end
end)

1 answer

Log in to vote
0
Answered by 2 years ago
Edited 2 years ago

put this at line 21:

if hit.Parent:FindFirstChild("Humanoid") and not debounce then

you're doing humanoid == true, which is incorrect. instead, use:

if hit.Parent:FindFirstChild("Humanoid") then

which means it checks if Humanoid exists, hopefully this helps! oh also, "not debounce" means "debounce == false", pretty much the same

0
Didn't work. Again, no errors in anything, but its not working. Im really pissed because all of my other scripts are doing the same thing. NO error at ALL. Ive rewritten this script in different ways and forms several times, along with other scripts of mine, and nothing seems to work. ThazCameronToU 0 — 2y
Ad

Answer this question