I am currently having an issue with the remote events in my game.
For context: I’m trying to fire a remote event from a server script to trigger a local script but no matter what I try it does not work.
I made print statements to print out when it fires and when it receives the signal from the remote event and it only prints when the remote event is fired.
Here are my scripts:
Server script
local prox = script.Parent
local down = script.Parent.Parent.Parent.HouseGoInsideTeleport
local snod1 = down.dooropen
local snod2 = down.doorclose
local tranrem = game.ReplicatedStorage.transition
local TweenService = game:GetService("TweenService")
local textLabel = game.StarterGui.Transition.tran
prox.Triggered:Connect(function(plr)
tranrem:FireClient(plr)
print("fired")
wait(0.33)
snod1:Play()
plr.Character.HumanoidRootPart.CFrame = CFrame.new(down.Position)
wait(0.5)
snod2:Play()
end)
LocalScript
local tranrem = game.Workspace.Interactables.Teleporters.HouseGoInside.ProximityPrompt.transition
local TweenService = game:GetService("TweenService")
local textLabel = game.StarterGui.Transition.tran
tranrem.OnClientEvent:Connect(function()
print("recieved")
TweenService:Create(textLabel, TweenInfo.new(0.3), {Transparency = 0}):Play()
wait(1)
TweenService:Create(textLabel, TweenInfo.new(0.3), {Transparency = 1}):Play()
end)
I’d greatly appreciate any sort of help with this issue.
I think the problem is that you’re trying to change the StarterGui instead of the player’s GUI. The StarterGui is a template GUI that is used to create new GUIs for each player when they join the game. Once a player’s GUI is created, it is no longer connected to the StarterGui.
To fix this, you need to get a reference to the player’s GUI. You can do this using the Players.LocalPlayer.PlayerGui property.
Here is a revised version of your local script:
local tranrem = game.Workspace.Interactables.Teleporters.HouseGoInside.ProximityPrompt.transition
local TweenService = game:GetService("TweenService")
local textLabel = game:GetService("Players").LocalPlayer.PlayerGui.Transition.tran
tranrem.OnClientEvent:Connect(function()
print("recieved")
TweenService:Create(textLabel, TweenInfo.new(0.3), {Transparency = 0}):Play()
wait(1)
TweenService:Create(textLabel, TweenInfo.new(0.3), {Transparency = 1}):Play()
end)
This should work correctly.
Give it a try and let me know if you have any other questions.
I have my own normal layout for my responses that I always use to stay formal, and I’m using that layout in this response. I’m learning to be more casual in my responses, mostly for game announcements/decisions. I’d rather use the devforum to help users, instead of auguring so I won’t turn this into a argument.