Sorry for the late reply, but I’ve made some code using the zone module. You could also do this with click detectors or touched, but zone is better imo.
Server
local remote = game:GetService("ReplicatedStorage").RebirthEvent
local part = game:GetService("Workspace").RebirthZone
local zoneModule = require(script.Zone)
local guiZone = zoneModule.new(part)
guiZone.playerEntered:Connect(function(plr)
if plr.PlayerGui:FindFirstChild("VeryEpicGui") then return end
local c = script.VeryEpicGui:clone()
c.Parent = plr.PlayerGui
end)
guiZone.playerExited:Connect(function(plr)
while plr.PlayerGui:FindFirstChild("VeryEpicGui") ~= nil do
plr.PlayerGui:FindFirstChild("VeryEpicGui"):Destroy()
end
end)
remote.OnServerEvent:Connect(function(plr)
-- any logic for checking if player is eligible for rebirth
plr.leaderstats.Points+=part.PointsWorth.Value -- this script can be edited to give different amounts of points, just remember to never have the client tell how many points to give.
plr.leaderstats.Stage.Value = 1
plr:LoadCharacter()
end)
client
local remote = game:GetService("ReplicatedStorage").RebirthEvent
script.Parent.NoButton.MouseButton1Click:Connect(function()
script:FindFirstAncestorOfClass("ScreenGui"):Destroy()
end)
script.Parent.YesButton.MouseButton1Click:Connect(function()
script:FindFirstAncestorOfClass("ScreenGui"):Destroy()
remote:FireServer()
end)