Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

RemoteEvent Script. Works in studio, but not in actual server?

Well, this script works in studio. Opens the door, does what it is meant to do. But however, in a real server, The script doesn't work. It inputs the click detector and all but it just doesn't work. I have filtering enabled turned ON. I tried to follow exactly what Roblox said to do if you have click detectors and filtering enabled.

This script is a serverscript:

wait(1)
local event = Instance.new("RemoteEvent") 
event.Parent = game.Workspace 
event.Name = "LeftDoorEvent"

event.OnServerEvent:connect(function()
	local Door = game.Workspace.LeftDoor1
	local main = Door:GetPrimaryPartCFrame()
	local part = Door.PrimaryPart
	local clic = Door.ClickDetector
	local sound = Door.Sound 
	if Door.Open.Value == 1 then 
		sound:Play()
		local fix = Door.Main.CFrame 
	for i = 0,1.5,0.1 do
		wait(0.05)
		Door:SetPrimaryPartCFrame(Door.Main.CFrame*CFrame.fromEulerAnglesXYZ(0,-0.1,0)*CFrame.new(0.01,0,-0.25))
		Door.Open.Value = 0
		clic.MaxActivationDistance = 0
	end
		Door:SetPrimaryPartCFrame(fix*CFrame.fromEulerAnglesXYZ(0,-math.pi/2,0)*CFrame.new(-2.5,0,-2.5))
		wait(0.25)
		clic.MaxActivationDistance = 15
	elseif Door.Open.Value == 0 then
		sound:Play()
		local fix = Door.Main.CFrame 
	for i = 0,1.5,0.1 do
		wait(0.05)
		Door:SetPrimaryPartCFrame(Door.Main.CFrame*CFrame.fromEulerAnglesXYZ(0,0.1,0)*CFrame.new(-0.01,0,0.25))
		clic.MaxActivationDistance = 0
	end
		Door:SetPrimaryPartCFrame(fix*CFrame.fromEulerAnglesXYZ(0,math.pi/2,0)*CFrame.new(-2.5,0,2.5))
		wait(0.25)
		clic.MaxActivationDistance = 15
		Door.Open.Value = 1
	end 
end)

This is the localscript [which is in replicated first]:

wait(5)
local clickDetector = Instance.new("ClickDetector")
clickDetector.Parent = game.Workspace.LeftDoor1
clickDetector.MouseClick:connect(function(hit)
	game.Workspace.LeftDoorEvent:FireServer()
end)

There is no output error. The only thing that doesn't work is the script in an actual server.

1 answer

✓ Accepted answer

ClickDetectors do not work with with filtering enabled. You'll need to code your own behavior to emulate it. Sorry :(

2 comments

0

...How would one suggest i start this...

0

The easiest way is just to hook up an event to MouseButton1Down and then do stuff depending on mouse.Target's name. If you want the click icon when you hover over clickable parts, you can change that on RenderStepped/MouseMove.

This discussion is preserved as it was. New answers, comments, and votes are closed.