I'm making a horror game and I have made a script In a text label, Which I have disabled Because I don't want the scripts to instantly start when you join the game. I want it to Get enabled when a player touches a certain part. How can I do this? I have searched in google and Dev forums etc. but I didn't quite find what I needed.
Here is the script I wrote But it Still doesn't work, Is there any other way for me to type it?
local Text = game.StarterGui.ScreenGui.TextLabel
local StarterGUI = game.StarterGui
local ScreenGUI = game.StarterGui.ScreenGui
function onTouched(part)
local h = part.Parent:findFirstChild("Humanoid")
if h~=nil then
ScreenGUI.Enabled = true
Text.Script.Enabled = true
end
end
script.Parent.Touched:connect(onTouched)

1 comment
Coding is case sensitive, so you want to make all your words capitalized correctly.