:FireServer() not working

Hey Everyone! I’m trying to make a :FireServer() to enable a ServerScript from a LocalScript, but for some reason when I do this, nothing happens, not even an error

Here’s a part of the code

--ClickDetector Triggers Script
--"Destiny" is located by a loop through

local Destiny = DestinyFolder:FindFirstChild(ObjName)
local EffectEvent = game:GetService("ReplicatedStorage").Events:WaitForChild("Pickable_Destiny")
local EffectScript = Destiny.Effect

if Destiny then
	EffectEvent:FireServer(EffectScript)
else
	print("Destiny object not found")
end

image

--Handler Script
local Folder = script.Parent

local PickableDestiny = script.Parent:WaitForChild("Pickable_Destiny")
PickableDestiny.OnServerEvent:Connect(function(player, DestinyEffect)
	local EffectScript = game:GetService("Workspace"):GetDescendants(DestinyEffect)
	
	if script then
		script.Disabled = false
	end
end)

I think this is what you’re trying to do for the handler:

--Handler Script
local Folder = script.Parent

local PickableDestiny = script.Parent:WaitForChild("Pickable_Destiny")
PickableDestiny.OnServerEvent:Connect(function(player, DestinyEffect)
	if DestinyEffect then
		DestinyEffect.Disabled = false
	end
end)
1 Like

Doesn’t seem to be that… I might have done something else wrong…

I just find it strange how you are firing to the server on ClickDetector click… Wouldn’t that already be in the server? Maybe use a BindableEvent instead. Also, moving your Handler script to ServerScriptService might help.

1 Like

Why are you using FireServer in an event that can easily just be serversided? No need for all of this when you can just use what Roblox intended.

1 Like

Scripts do not run in replicatedstorage. move it to server-script service.

1 Like

ReplicatedStorage is reserved specifically for storage only. Scripts and LocalScripts will not run in it. I recommend moving your script to ServerScriptService instead.

1 Like

I’m making a Carrying System, so it’s easier to set up everything on the client and then just add a ClickDetector to the part that I want to be pickable.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.