Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Kocking system will not function?

This scripts uses a proximity prompt and is SS

the script

local SoundService = game:GetService("SoundService")

local prompt = script.Parent
local Vent = game.Workspace.MainVent.Vent

local knock = SoundService.Knock
local fall = SoundService.VentFall

local function typewrite(object, text)
	for i = 1, #text,1 do
		object.Text = string.sub(text,1,i)
		wait(0.0227272727) -- how long it takes to type the sentence 
	end
end
	
prompt.Triggered:Connect(function()
	typewrite(game.StarterGui.Inputs.TextLabel, "You knock on the door, but hear no response.")
	knock:Play()
	wait(2)
	fall:Play()
	Vent.Anchored = false
	
game.StarterGui.Inputs.TextLabel.Text = ""

end)

for some reason it shows no errors but doesnt work

1 answer

✓ Accepted answer

You're using StarterGui instead of PlayerGui. All childrens of StarterGui will automatically be transferred into PlayerGui.

local SoundService = game:GetService("SoundService")

local prompt = script.Parent
local Vent = game.Workspace.MainVent.Vent

local knock = SoundService.Knock
local fall = SoundService.VentFall

local function typewrite(object, text)
    for i = 1, #text,1 do
        object.Text = string.sub(text,1,i)
        wait(0.0227272727) -- how long it takes to type the sentence 
    end
end

prompt.Triggered:Connect(function(plr) -- Tip: Proximity Prompt Triggered can use it's parameter to identify player that triggered the prompt.
    typewrite(plr.PlayerGui.Inputs.TextLabel, "You knock on the door, but hear no response.")
    knock:Play()
    wait(2)
    fall:Play()
    Vent.Anchored = false
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.