wait i thought that was in a localscript, my bad, if its in serverscript, you shouldnt :FireServer(), and you can parent clones of the GUI in their PlayerGui
local ScreenGui = --Put your screenGui containing your popup
local player2 = --Player2
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
game.Workspace.Baseplate.Touched:Connect(function(hit)
local Clone1 = ScreenGui:Clone()
local Clone2 = ScreenGui:Clone()
Clone1.Parent = plr.PlayerGui
Clone2.Parent = Player2.PlayerGui
end)
end)
end)
wait i thought that was in a localscript, my bad, if its in serverscript, you shouldnt :FireServer(), and you can parent clones of the GUI in their PlayerGui
Alright, If you want to get 2 players on a thing at the same time do something like
local Block = --Put Part
local GUI = --PutScreenGui
local playersFound = false
spawn(function()
repeat
local Table = Block:GetTouchingParts()
local Players = {}
for i,v in ipairs(Table) do--How we gett our players touching the part
local Player = game.Players:GetPlayerFromCharacter(v.Parent)
if Player and not table.find(Players, Player) then --Player does exist and is not in table
Players[#Players+1] = Player
end
end
if Players[1] and Players[2] then
GUI:Clone().Parent = Players[1].PlayerGui
GUI:Clone().Parent = Players[2].PlayerGui
playersFound = true
end
wait(0.01)--Decrease this for faster response, Increase this for less lag(if there is any)
until playersFound = true
end)
No, look. The player will have at the beginning of the game a Gui. When the player touches the base plate then the two player pops up a gui at their screen. Btw the gui goes visible
If you want a gui to pop up on players once they touch the baseplate:
local Players = game:GetService('Players')
local gui = --gui object that will pop up
local base = --the baseplate
Players.PlayerAdded:Connect(function(player)
local char = player.Character or player.CharacterAdded:Wait()
local touched = false -- so it doesnt repeat
base.Touched:Connect(function(hit)
if hit.Parent == char and not touched then
local guiClone = gui:Clone()
touched = true
guiClone.Parent = player.PlayerGui
end
end)
end)
-- You don't need all that for checking a touched event
game.Workspace.Baseplate.Touched:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
-- Checks if player exists
if player then
Remote:FireClient(player)
end
end)
StarterGui
-- If the event is fired
Remote.OnClientEvent:Connect(function()
local frame = PATH_TO_FRAME
-- Make frame visible, tween it using :TweenPosition, etc
end)