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

How do I make it so that when I try to use the wrong key card text appears?

Asked by 4 years ago

I want to have a door where you have to have a level 2 key card to open it. I also wanted to have text appear if you try to use a level 1 key card saying that it's not a high enough clearance. I've already got the script for the level 2 key card to open the door, I just need the script to make the text to appear for the level 1 key card saying it isn't high enough clearance. Here is the Script I have for the door and some script I have for the level 1 key card, it only plays a sound though.

script.Parent.Touched:Connect(function(hit)
    if hit.Parent.Name == "KeycardLV2" then
        game.Workspace.KeyAccepted:Play()
        script.Parent.CanCollide = false
        script.Parent.Transparency = 1
        game.Workspace.BigDoorOpen:Play()
        wait (5.5)
        script.Parent.CanCollide = true
        script.Parent.Transparency = 0
        game.Workspace.BigDoorClose:Play()
    end
    if hit.Parent.Name == "KeycardLV1" then 
        game.Workspace.KeyDenied:Play()

    end
end)

Any ideas?

1 answer

Log in to vote
0
Answered by 4 years ago

I would recommend adding a TextLabel in a Screen GUI, and only enabling that when the key card isn't at a high enough clearance.

If you would like resources on how to make ScreenGUIs, then I will list some sources below:

https://developer.roblox.com/en-us/api-reference/class/ScreenGui https://www.youtube.com/watch?v=egUMoynJz1g

If you find this useful consider to accept this as an answer.

Ad

Answer this question