Whats wrong with this transition code?

I want to make it so when the player uses a part that has proximity it teleports them to the other part named (Togamedoor) with a fancy fade in and out transition.
Ive added a screenGUI and a frame for transition and named the screenGUI Transition and the frame is Fade

but all it does it teleport me without transition

ive tried rewriting the code and reading to see if there are any errors and yet it still wont work

Heres both parts to the script part A is for teleporting and Script B is for transition.

local ProximityPrompt = script.Parent
ProximityPrompt.Triggered:Connect(function(Player)
	if hit.Parent:FindFirstChild("Humanoid") then
		local player = game.Players:GetPlayerFromCharacter(hit.Parent)
		game.ReplicatedStorage.ShowTransition:FireClient(player)
		task.wait(.5)
		local character = player.Character
		character.HumanoidRootPart.CFrame = game.Workspace.Togamedoor.CFrame
	end
end)
local remoteevent = game.ReplicatedStorage.ShowTransition

remoteevent.OnClientEvent:Connect(function()
	local tweenservice = game:GetService("TweenService")
	local tweeninfo = TweenInfo.new(.5, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut)
	local fadein = tweenservice:Create(script.Parent, tweeninfo, {BackroundTransparency = 0})
	local fadeout = tweenservice:Create(script.Parent, tweeninfo, {BackroundTransparency = 1})
	fadein:Play()
	task.wait(1)
	fadeout:Play()
end)

image
You’ve tried rewriting the code and managed to overlook this… I think this might answer itself.

what i change hit to trigger? is that the problem or am i seeing somth else

Not sure how you can’t see it, but then again it’s a kids game I can’t blame you for not seeing it.
hit isn’t a thing here (as far as I can tell), and you’re using it to get a player instance, which you get from the proximity prompt anyway. So the right code would be:

ProximityPrompt.Triggered:Connect(function(player)
	game.ReplicatedStorage.ShowTransition:FireClient(player)
	task.wait(.5)
	local character = player.Character
	character.HumanoidRootPart.CFrame = game.Workspace.Togamedoor.CFrame
end)

Sorry to say this but it didnt work.
as i used the code you suggested, the code wont even work now and i cant teleport.

1 Like

Any errors in console? It’s extremely weird that the code I gave you works worse than the original.

Just 1
Workspace.Worlddoor.ProximityPrompt.script:1: attempt to index nil with ‘Triggered’

in line 1

1 Like

It’d be nice for you to name any errors from the code that show up from now on, so we can fix this faster.
This error just means that ProximityPrompt is nil. Did you replace the entire script with the fixed code? Sorry, I should’ve added that you still need the local ProximityPrompt = script.Parent at the top there.

I can now teleport again but the transition i had in the other code wont work

1 Like

Any other errors? I can’t really see any other oversights in the code.

none no errors its just the fact that the transition i made doesnt work… its what i rlly want to work but im so confused why its not working

1 Like

Can I double check what the code looks like now, in both scripts? You might have made a typo somewhere.

local ProximityPrompt = script.Parent
ProximityPrompt.Triggered:Connect(function(player)
	game.ReplicatedStorage.ShowTransition:FireClient(player)
	task.wait(.5)
	local character = player.Character
	character.HumanoidRootPart.CFrame = game.Workspace.Togamedoor.CFrame
end)
local remoteevent = game.ReplicatedStorage.ShowTransition

remoteevent.OnClientEvent:Connect(function()
	local tweenservice = game:GetService("TweenService")
	local tweeninfo = TweenInfo.new(.5, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut)
	local fadein = tweenservice:Create(script.Parent, tweeninfo, {BackroundTransparency = 0})
	local fadeout = tweenservice:Create(script.Parent, tweeninfo, {BackroundTransparency = 1})
	fadein:Play()
	task.wait(1)
	fadeout:Play()
end)

Put in prints to check to see what’s working or not working.
local remoteevent = game.ReplicatedStorage.ShowTransition

remoteevent.OnClientEvent:Connect(function()
    print(script.Parent.Name) 
    -- sees if the item is actually there, and lets you know if this code actually is firing
	local tweenservice = game:GetService("TweenService")
	local tweeninfo = TweenInfo.new(.5, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut)
	local fadein = tweenservice:Create(script.Parent, tweeninfo, {BackroundTransparency = 0})
	local fadeout = tweenservice:Create(script.Parent, tweeninfo, {BackroundTransparency = 1})
	fadein:Play()
    print("fadein played")  -- just another check
	task.wait(1)
	fadeout:Play()
end)

And are these scripts local or server scripts?

1 Like

Local script

its placed in StarterGUI under the frame thats under the screenGUI

but the transition still didnt work

i got an error in console

Players.PlainJordan.PlayerGui.Transition.Fade.Transition:1; Expected Identifier when parsing expression got ’ . ’

Both scripts are local?
So in the error check that line of code. It’ll be identifiable as the script that’s in your workspace character, in the PlayerGui.Transition.Fade.Transition script.

Theyre both local but whats the error???

If they’re both local, the reason it doesn’t fire is because you’re trying to use a server method on the client (RemoteEvent:FireClient())
I’d suggest making the script moving the player a server script, so that the movement replicates to other players.

1 Like

Nvm forget it i found a model online with a working script and stuff.
He has another transition added in replicated storage for animation or somth