Hello, I'm wondering how I can go about with this "FireallClients", it's claiming that it needs to be fired by the server, but it's in a server script + in workspace located inside the food gui.
Code: https://hastebin.com/foyaruyani.bash
Thanks, Rook.
Try this:
script.Parent.MouseButton1Click:connect(function() local txt = "You want a taco? Alright, here you go." if script.Parent.Parent.Debounce.Value == false then script.Parent.Parent.Debounce.Value = true for i = 1,#txt do script.Parent.Parent.Parent.CafeStuff.TextLabel.Text = string.sub(txt,1,i) wait(.01) end script.Parent.Parent.Money:play() script.Parent.text.Text = "Sold!" local ReplicatedStorage = game:GetService("ReplicatedStorage") local GiveFoodRequest = ReplicatedStorage:WaitForChild("GiveFoodRequest") local result = GiveFoodRequest:InvokeServer("Taco",3) print(result) --delete later wait(1) script.Parent.text.Text = "Taco ($3)" script.Parent.Parent.Debounce.Value = false end end)
And add this script to your ServerScriptStorage
local ReplicatedStorage = game:GetService("ReplicatedStorage") local GiveFoodRequest = Instance.new("RemoteFunction") GiveFoodRequest.Name = "GiveFoodRequest" GiveFoodRequest.Parent = ReplicatedStorage GiveFood = ReplicatedStorage:WaitForChild("GiveFood") local function OnGiveFoodRequest(player,food,amount) --just guessing here GiveFood:FireAllClients(food,amount,player.Name) return "Success" end GiveFoodRequest.OnServerInvoke = OnGiveFoodRequest