I am trying to make it so when the player touches this brick, a GUI is cloned and pops-up on the clients screen, and with that he can purchase a car and it will spawn in a designated area. When I try it in studio, it works fine, but in game it does not respond. The GUI (called SpawnGUI) will open, however none of the scrolling buttons nor the buy button works.
I have posted a copy of the script below. I am not used to filtering enabled, so I am not sure how to use remote events or remove functions. The player must click the buy button, which takes away 50 "Money" from the leaderstats and places the vehicle desired (all vehicles located in ServerStorage) in a specific place where all the cars will spawn.
Script for spawning GUI
script.Parent.Touched:connect(function(p)
local player = game.Players:GetPlayerFromCharacter(p.Parent)
if (player) then
if (not player.PlayerGui:FindFirstChild("SpawnGUI")) then
local GUI = game:GetService("ServerStorage").SpawnGUI:Clone()
GUI.Regen.Value = script.Parent.Parent.Pos
GUI.Parent = player.PlayerGui
end
end
end)
local s = 0
while wait(0.1) do
s = (s + 2) % 360
script.Parent.UI.StudsOffset = Vector3.new(0,5 + math.sin(math.rad(s)),0)
end
Script for giving car:
local P = script.Parent
local player = P.Parent.Parent
local index = 1
local vehicles = {
{"Toyota Corolla 2010" , 0},
{"Smart Fortwo" , 0},
{"Sudiko Green Yoga" , 0},
{"Sudiko Blue Yoga" , 0},
{"Toyota Prius 2010" , 0},
{"BMW i3" , 0},
{"TCI" , 0},
{"Toyota Prius 2016" , 0}
}
wait(0.5)
-- GUI vars
local bg = P.BG
-- Helper function
function SetInformation(index)
bg.I.Image = "http://www.roblox.com/thumbs/asset.ashx?assetId="..vehicles[index][2].."&x=420&y=420"
bg.T.Text = vehicles[index][1]
end
local locked = false
bg.S.MouseButton1Click:connect(function()
local Money = player.leaderstats:FindFirstChild("Money")
if Money.Value > 50 then
Money.Value = Money.Value - 50
if (locked) then return end
locked = true
local vehicleName = player.Name.."Car"
local model = workspace:FindFirstChild(vehicleName)
if (model) then model:Destroy() end
model = game.ServerStorage.Vehicles:FindFirstChild(vehicles[index][1]):Clone()
model.Name = vehicleName
model.Parent = game.Workspace
model:MakeJoints()
model:MoveTo(P.Regen.Value.Position)
P:Destroy()
locked = false
else
script.Parent.BG.S.Text = "Not Enough Money, 50 Needed!"
wait(3)
script.Parent.BG.S.Text = "Spawn"
end
end)
bg.B.MouseButton1Click:connect(function()
index = index - 1
if (index < 1) then index = #vehicles end
SetInformation(index)
end)
bg.N.MouseButton1Click:connect(function()
index = index + 1
if (index > #vehicles) then index = 1 end
SetInformation(index)
end)
bg.Q.MouseButton1Click:connect(function()
P:Destroy()
end)
SetInformation(index)
Please help me find a solution that it will work with filtering enabled, and please describe in detail the steps needed. Thankyou!

7 comments
well, does the Dev Console tell anything whilst playing the game?
Nope. All it says is the meshes failed to load
Make the second script a LocalScript
The second script being a localscript would be bad. That would make it so that the car only shows up on the player's system, so other players would not notice it.
Then what should I do?
Just dump the Touched function in the client. much easier. no server communication needed.
And how would I do that? Remember im a beginner