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
--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)
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.
ReplicatedStorage is reserved specifically for storage only. Scripts and LocalScripts will not run in it. I recommend moving your script to ServerScriptService instead.
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.