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

how to fix my job script w/ filtering enabeld?

so i made a job script almost a year ago it wasent verry good but it worked with filtering disabeld now i joined my place still filtering disabeld but it wont work anymore can some one help me also i want this to have filtering enabeld i made a folder in my replicated storage called remote event with the event called jobevent

so this is in a surface gui inside of workspace that gets cloned out of server storage

Player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function()
    Player.leaderstats.Money.Value = Player.leaderstats.Money.Value + 100
	game.Workspace.Good:Destroy()
	game.Workspace.Wrong1:Destroy()
	game.Workspace.Wrong2:Destroy()
	game.Workspace.Wrong3:Destroy()
	if game.Workspace:FindFirstChild("NPC") then
game.Workspace.NPC:Destroy()
end
end)

1 answer

✓ Accepted answer

To get this to work you will need a remote event, best put inside of a folder of ReplicatedStorage. Name it whatever you want.

For the code inside of your local script you would change it to:

local Replicated = game:GetService("ReplicatedStorage")
local Event = Replicated.Event.EventName

script.Parent.MouseButton1Click:Connect(function()
	Event:FireServer()
end)

Then you would put another script inside of ServerScriptService with this code:

local Replicated = game:GetService("ReplicatedStorage")
local Event = Replicated.Event.EventName

local function Job(Player)
	Player.leaderstats.Money.Value = Player.leaderstats.Money.Value + 100
	workspace.Good:Destroy()
	workspace.Wrong1:Destroy()
	workspace.Wrong2:Destroy()
	workspace.Wrong3:Destroy()
	if workspace:FindFirstChild("NPC") then
		workspace.NPC:Destroy()
	end
end

Event.OnServerEvent:Connect(Job)

Your welcome

6 comments

0

ehm a new bugg has come up it says server can only be called from client

0

did you put the first script inside of a local script inside of the surface gui?

0

yes

0

if you would like I can give a bit of help if you add me to a team create. Just friend roy6576

0

i will do it tommrow

0

kk

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