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)
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)
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.
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)
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.
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.