I'm making a script that changes a gui after a player teleports, and it uses a remote event to change the gui
here's the server script in the block:
local PassId = 4920137
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local MarketplaceService = game:GetService("MarketplaceService")
local debounce = false
local pos = CFrame.new(3.112, 5.216, -183.121)
local getPlayerFromCharacter
local player
local remote = game.ReplicatedStorage:WaitForChild("RemoteE")
getPlayerFromCharacter = function(model)
local plr = Players:GetPlayerFromCharacter(model)
if plr then
return plr
else
return nil
end
end
script.Parent.Touched:Connect(function(hit)
local player = getPlayerFromCharacter(hit.Parent)
if player then
if not debounce then
debounce = true
player.Character:SetPrimaryPartCFrame(pos)
remote:FireClient(nil)
wait(1)
debounce = false
end
end
end)
here's the local script under the image label of the gui and it's in starter gui:
local remote = game.ReplicatedStorage:WaitForChild("RemoteE")
remote.OnClientEvent:Connect(function()
for i = 0, 1, 0.1 do
script.Parent.ImageTransparency = i
wait(.1)
end
end)

1 comment
On line 36 replace nil with player