I have a block that, when touched, uses a remote function to pop up a gui that, when clicked, should make the block fade and another part appear. The other part is only appearing about half the time. Here's a stripped down version of what I have:

--Server-side
local db = true
door.Touched:connect(function(hit)
	if db and hit.Parent:FindFirstChild('Humanoid') ~= nil then
		db = false
		game.ReplicatedStorage.RemoteFunction:InvokeClient(hit.Parent)
		db = true
	end
end)
	
game.ReplicatedStorage.RemoteFunction.OnServerInvoke = function(plr)
	RecurVisible(Signs) --this function actually sets the transparency of the part to zero to make it appear. It works every time when I test it by itself.
	while door.Transparency < 1 do
		door.Transparency = door.Transparency + .02
		wait(0)
	end --the door has always gone transparent and been destroyed
	door:Destroy()
	RecurVisible(Signs) --I put it again, just in case, but that hasn't helped.
end
--Client-side
local Screen = script.Parent
local button= Screen.Button
RemoteFunction.OnClientInvoke = function(oldOwner)
	if oldOwner == nil then
		script.Parent.button.Visible = true
	end
end

button.MouseButton1Click:connect(function()
	button.Visible = false
	RemoteFunction:InvokeServer()
end)

No errors are being given in the output. Could it be because of the remote function? Once again, it works about half the time.

2 comments

0

Can you post the full scripts?

0

Everything else works when I do it independantly. What specifically do you want to see?