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

Two scripts work perfectly fine in a local test, but not with filtering enabled???

I'm making a GUI button that when pressed converts a currency called "etherium" into cash. Problem is, the scripts work perfectly fine in a local test but once I go into a filtering enabled environment they fail to work. Etherium is stored in a folder inside of the player, and cash is in the server storage.

--This is the local script inside of a button

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local EthTransfer = ReplicatedStorage:WaitForChild("EtheriumTransferService")

function onClick()
local p = game.Players.LocalPlayer
EthTransfer:FireServer(p)
script.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Cash:Play()
end

script.Parent.MouseButton1Down:connect(onClick)
--This is the script inside workspace
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local EthTransfer = Instance.new("RemoteEvent", ReplicatedStorage)
EthTransfer.Name = "EtheriumTransferService"

local function onEthFired(localPlayer)
print("recieved event")
local eth = localPlayer.EtheriumCount.Etherium
local Stats = game.ServerStorage.PlayerMoney:FindFirstChild(localPlayer.Name)
local addition = eth.Value * 10
Stats.Value = Stats.Value + addition
eth.Value = 0
print("event completed")
end

EthTransfer.OnServerEvent:Connect(onEthFired)

1 comment

0

Borderlands? Also "i before e, except after c" looool. Anyways, the problem is that you're are creating a new RemoteEvent with your localscript. What?! The point of FE is that no changes made by localscripts will be replicated to the server. Just have "EtheriumTransferService" made by the server script are already created by default.

1 answer

The answer is that you need put these lines

local EthTransfer = Instance.new("RemoteEvent", ReplicatedStorage)
EthTransfer.Name = "EtheriumTransferService"

into the server script. When you create the remote event on the localscript, it's local, so the server can't find it, and yields forever.

2 comments

0

Also note if you care about efficiency, don't format Instance.new(obj, parent), format it like EthTransfer = Instance.new(obj); (next line) EthTransfer.Parent = ReplicatedStorage.

0

No actually, its more efficiant to do (obj, parent)

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