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

text label not changing?

Asked by 4 years ago

Ive tried doing the text label effect the regular way but it wasnt work, so i changed to this, the text label still wont change though no errors;

01local plr = game.Players.LocalPlayer
02if workspace.IntroductionValue.Value == 1 then
03    print("(????)")
04    script.Parent.TextStrokeTransparency = 0
05    wait(0.1)
06    script.Parent.Text = "H"
07    wait(0.5)
08    script.Parent.Text = "Hu"
09    wait(0.5)
10    script.Parent.Text = "Huh"
11    wait(0.5)
12    script.Parent.Text = "Huh."
13    wait(0.5)
14    script.Parent.Text = "Huh.."
15    wait(0.5)
View all 55 lines...

2 answers

Log in to vote
1
Answered by 4 years ago

There is nothing activating the function.

Do the following. Create something that activates the function, such as a remoteEvent that, when triggered, does this.

So... Let's assume that the dialogue starts when the player touches a piece

To activate this RemoteEvent on the specific client, do the following.

01local Debounce = false -- Is a lock.
02 
03script.Parent.Touched:Connect(function(Hit)
04    if Debounce == false then
05        Debounce = true
06 
07        local Character = Hit.Parent
08        local Player = game.Players:GetPlayerFromCharacter(Character)
09        if Player then
10            script.Parent.RemoteEvent:FireClient(Player)
11        end
12 
13    end
14end)

In the LocalScript.

1local DialoguePart = workspace:WaitForChild("DialoguePart")
2local RemoteEvent = DialoguePart:WaitForChild("RemoteEvent")
3 
4RemoteEvent.OnClientEvent:Connect(function(Player)
5    -- Your Code here. To make changes to the text.
6end)

Hope this helps

Any questions, you can ask me

:)

0
Bruh Ziffixture 6913 — 4y
Ad
Log in to vote
1
Answered by 4 years ago
Edited 4 years ago

Try seeing if it's because you're using an if statement when you should have something that checks more often (if statements only run once)

Try:

01local plr = game.Players.LocalPlayer
02 
03workspace.IntroductionValue:GetPropertyChangedSignal("Value"):Connect(function()
04    if workspace.IntroductionValue.Value == 1 then
05        print("(????)")
06        script.Parent.TextStrokeTransparency = 0
07        wait(0.1)
08        script.Parent.Text = "H"
09        wait(0.5)
10        script.Parent.Text = "Hu"
11        wait(0.5)
12        script.Parent.Text = "Huh"
13        wait(0.5)
14        script.Parent.Text = "Huh."
15        wait(0.5)
View all 45 lines...
0
Use a for loop my guy. Ziffixture 6913 — 4y
0
It's good practice to use events instead of infinite loops. Having code run unnecessarily is... well unnecessary. SpelunkyGaming 34 — 4y

Answer this question