Answered by
pwx 1581
5 years ago
An easier way to do this is detect via Server-Side then use a RemoteEvent to fire the client.
Like so:
Server Script
02 | local part = script.Parent |
03 | local Players = game:GetService( 'Players' ) |
04 | local RS = game:GetService( 'ReplicatedStorage' ) |
07 | part.Touched:Connect( function (otherPart) |
08 | local Player = Players:GetPlayerFromCharacter(otherPart.Parent) |
10 | RS.RemoteEvent:FireClient(Player, 'Stage Two: Water!' ) |
Now, for the local script. Preferably put this inside StarterGui or the UI itself, doesn't matter.
LocalScript
01 | local Player = game.Players.LocalPlayer |
02 | local RS = game:GetService( 'ReplicatedStorage' ) |
04 | function textActivated(textInfo) |
05 | local textlabel = **TextLocationHere** |
06 | if textlabel.Visible = = false then |
07 | textlabel.Visible = true |
08 | textlabel.Text = textInfo |
10 | textlabel.Visible = false |
14 | RS.RemoteEvent.OnClientEvent:Connect(textActivated) |
In hindsight, you'll be able to use the same remote for each level change, just by changing the remote parameter to what you desire. The code is somewhat messy and rushed and could probably be a lot shorter but it's early in the morning and I haven't had my tea yet.
Either way, give that a go and let you know if you need any help.