I'm trying to make a text GUI appear on the screen when a block is touched. the touch script works and it enabled the other script, but it does not work. The script works when it's activated once the game starts, but not when a script activates it.
Touching Block script:
local p = script.Parent
local d = false
p.Touched:Connect(function(otherPart)
if otherPart and otherPart.Parent then
local h = otherPart.Parent:FindFirstChild("Humanoid")
if h then
if d == true then return end
d = true
game.Workspace.LocalScript1.Disabled=false
wait(1)
d = false
end
end
end)
After Block touched this activates but won't work.
local text = "Congrats!"
local player = script.Parent.Parent
local gui = script.Parent
local sound = Instance.new("Sound",gui)
sound.SoundId = "http://www.roblox.com/asset/?id=14863866"
sound.Pitch = 1
sound.Volume = 0.8
local frame = gui.Frame
local text1 = frame.TextLabel
wait(0.5)
for i = 1,string.len(text),1 do
sound:play()
text1.Text = string.sub(text,1,i)
wait(1)
local text = "Congrats!"
end
