✓ Accepted answer
An easier way to do this is detect via Server-Side then use a RemoteEvent to fire the client.
Like so:
Server Script
local part = script.Parent
local Players = game:GetService('Players')
local RS = game:GetService('ReplicatedStorage')
part.Touched:Connect(function(otherPart)
local Player = Players:GetPlayerFromCharacter(otherPart.Parent)
if Player then
RS.RemoteEvent:FireClient(Player, 'Stage Two: Water!')
end
end)
Now, for the local script. Preferably put this inside StarterGui or the UI itself, doesn't matter.
LocalScript
local Player = game.Players.LocalPlayer
local RS = game:GetService('ReplicatedStorage')
function textActivated(textInfo)
local textlabel = **TextLocationHere**
if textlabel.Visible == false then
textlabel.Visible = true
textlabel.Text = textInfo
wait(2)
textlabel.Visible = false
end
end
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.
1 comment
I know, this code is stupid, i just noticed