Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to fix this job script no output error i dont know what i did wrong please help me?

Asked by
hokyboy 270 Moderation Voter
5 years ago
Edited 5 years ago

I Need Help With My Job Script

Hello my name is hokyboy and i am trying to make a job script for a pizza place in my game.

I dont know what i did wrong but it doesnt work. I have tried almost everything(im a starting scripter so i dont know everything)

so first i will explain how it works so there are 4 buttons and a npc getting cloned in a loop these 4 buttons have surface guis in them.

script of the button.

local Replicated = game:GetService("ReplicatedStorage") local Event = Replicated.RemoteEvents.JobEvent script.Parent.MouseButton1Click:Connect(function() Event:FireServer() end)

here is the script that i have to give the money and despawn the buttons and npc

local Replicated = game:GetService("ReplicatedStorage")
local Event = Replicated.RemoteEvents.JobEvent
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)

i checked for any gramatical errors or output errors i dont have any also i checked if the events exist they do

btw if u want to help me make a new job script please hit me up. also sorry if this isent formatted good!

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

So I noticed a few things about your script, but to know exactly what to fix I'm going to need to know what type of script the scripts are (local, server) and if this script actually does anything. But try doing a few of these fixes anyways, maybe that'll fix your problem?

Firstly, I know you've said that the events do exist, but neither of the scripts create the event? Create the event using a script, not just insert it into the replicated storage yourself. Replace the remoteevent stuff in the click script with this:

local Replicated = game:GetService("ReplicatedStorage")
local Event = rs:WaitForChild("JobEvent")

And the remote event stuff in the other script with this:

local Replicated = game:GetService("ReplicatedStorage")
local Event = Instance.new("RemoteEvent")
Event.Parent = Replicated
Event.Name = ("JobEvent")

Secondly, what is line 4 of your second script exactly supposed to do? It doesn't set a variable or set a value, it's just there, and I thought maybe there's something you forgot to do with that line? (This line)

Player.leaderstats.Money.Value
Ad

Answer this question