You can use the Player.Chatted event which fires whenever the player chats.
Chat Script:
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Remote = RemoteEvent.UIRemote
Players.PlayerAdded:Connect(function(Player)
local OnStage = Instance.new("BoolValue", Player)
OnStage.Name = "OnStage"
OnStage.Value = false
Player.Chatted:Connect(function(Message)
if OnStage.Value == true then
Remote:FireAllClients(Message)
end
end)
end)
Random Player Picker Script:
local Players = game:GetService("Players")
local StageCFrame = CFrame.new(11.667, 23.652, 95.261)
local bindableEvent = Instance.new("BindableEvent")
function tpRandomToStage()
task.wait(5)
local allPlayers = Players:GetPlayers()
local randomNumber = Random.new(os.time()):NextInteger(1, #allPlayers)
local randomPlayer = allPlayers[randomNumber]
local randomCharacter = randomPlayer.Character
local randomHumanoid = randomCharacter:FindFirstChildWhichIsA("Humanoid")
randomPlayer.CharacterAdded:Connect(function()
bindableEvent:Fire()
end)
Players.PlayerRemoving:Connect(function(player)
if player == randomPlayer then
bindableEvent:Fire()
end
end)
randomCharacter:PivotTo(StageCFrame)
randomPlayer.OnStage.Value = true
task.wait(45)
randomPlayer:LoadCharacter()
randomPlayer.OnStage.Value = false
end
while true do
local thread = task.spawn(tpRandomToStage)
bindableEvent.Event:Wait()
coroutine.close(thread)
end
The script for the GUI:
local Remote = game.ReplicatedStorage:WaitForChild("UIRemote")
local player = game.Players.LocalPlayer
Remote.OnClientEvent:Connect(function(chat)
player:WaitForChild("PlayerGui"):WaitForChild("RappersChat").Inside.Chat.Text = chat
end)
14 comments
So do you know how to make it so their chat shows up in the GUI when they are standing on a specific part btw? Becuase i want only the person on stage to have the GUI contain what they say.
and theres an error or sumthing that says "Infinite yield possible on 'ReplicatedStorage:WaitForChild("UIRemote")" im also not using there model i only wanted the gui thingy from it nothing else. no Main Script or anything else from them
It should work as what you said. Maybe you did it wrong. Should I create a simple model for you?
If you can, but I don't want to waste your time.
ok thx :thumbs_up:
I finally finished the model. Here it is: https://web.roblox.com/library/12326645112
Here is also the demo game if you wanna try it out first: https://web.roblox.com/games/12326265372
no way
web.roblox
holy i cant believe this thank you so much T_3MasterGamer :D
i have never been this happy this much so far this month but this is just the key to my game!! than you so much i love this!!
also don't worry about this but why do items dissapear when they get off the stage?
It’s because they respawned.
Please mark my answer as solution thanks :D