It looks like there are a few issues in your code. Let's go through them step by step:
In your code, you're trying to access game.Players.LocalPlayer.PlayerGui.smth.Text directly. However, the LocalPlayer object might not be available in a LocalScript. Instead, you should use game.Players.LocalPlayer.PlayerGui to access the GUI, and then find the Text object within it. Make sure the hierarchy is set up correctly.
You have a typo in your code: task.wait(2) should be wait(2).
You're trying to change value.value, but it seems like you meant to change interact.Value.
Here's a corrected version of your code:
**local interact = script.Parent.Parent.interact
local tween = game:GetService("TweenService")
local info = TweenInfo.new(0.5)
local player = game.Players.LocalPlayer
local textGui = player.PlayerGui:WaitForChild("smth")
local text = textGui.Text
local function typewrite(object, text)
for i = 1, #text, 1 do
object.Text = string.sub(text, 1, i)
game.ReplicatedStorage.Click:Play()
wait(0.05)
end
end
interact:GetPropertyChangedSignal("Value"):Connect(function()
if interact.Value == true then
print("works")
local target = {TextTransparency = 0}
local tweeen = tween:Create(text, info, target)
tweeen:Play()
typewrite(text, script.Parent.Value)
wait(2) -- Fix the typo here
interact.Value = false -- Fix this line to change interact.Value
local target = {TextTransparency = 1}
local tweeen = tween:Create(text, info, target)
tweeen:Play()
end
end) **
Make sure that the hierarchy and naming match your actual game setup, especially regarding the GUI elements. Also, ensure that the Click sound exists in ReplicatedStorage.
** You are now Level 2! **
