-
What do you want to achieve? Keep it simple and clear!
A working tool shop -
What is the issue? Include screenshots / videos if possible!
The shop is not working and there’s an error saying "Attempt to connect failed: Passed value is not a function " Which I don’t know what it means and how to fix it. -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
Searching for solution but still can’t find
Here’s a local script which is in the shop gui
local open = game.Workspace.PartShop.PartShopPad
local close = game.Workspace.PartShop.PartShopTele
local Part8x8 = script.Parent.ScrollingFrame.Part8x8.TextButton
local Part16x8 = script.Parent.ScrollingFrame.Part16x8.TextButton
local Part24x8 = script.Parent.ScrollingFrame.Part24x8.TextButton
local Truss = script.Parent.ScrollingFrame.Truss.TextButton
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage:WaitForChild("BuyTool")
local function OpenShop(Parts)
local ply = game.Players:FindFirstChild(Parts.Parent.Name)
if ply then
ply.PlayerGui.PartsShop.Enabled = true
ply.Character.Humanoid.WalkSpeed = 0
end
end
local function CloseShop()
local ply = game.Players.LocalPlayer
ply.PlayerGui.PartsShop.Enabled = false
ply.Character.HumanoidRootPart.CFrame = CFrame.new(close.Position.X,close.Position.Y + 3,close.Position.Z)
ply.Character.Humanoid.WalkSpeed = 16
end
local function BuyTool8x8()
local tool = ReplicatedStorage.ShopItem.Part8x8
remoteEvent:FireServer(tool)
end
local function BuyTool16x8()
local tool = ReplicatedStorage.ShopItem.Part16x8
remoteEvent:FireServer(tool)
end
local function BuyTool24x8()
local tool = ReplicatedStorage.ShopItem.Part24x8
remoteEvent:FireServer(tool)
end
local function BuyToolTruss()
local tool = ReplicatedStorage.ShopItem.TrussPart
remoteEvent:FireServer(tool)
end
open.Touched:Connect(OpenShop)
script.Parent.Close.MouseButton1Click:Connect(CloseShop)
Part8x8.MouseButton1Click:Connect(BuyTool8x8)
Part16x8.MouseButton1Click:Connect(BuyTool16x8)
Part24x8.MouseButton1Click:Connect(BuyTool24x8)
Truss.MouseButton1Click:Connect(BuyToolTruss)
Here’s the server script
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage:WaitForChild("BuyTool")
local function BuyTool(player, tool)
local giveTool = ReplicatedStorage.ShopItem[tool.Name]:Clone()
giveTool.Parent = player.Backpack
end
remoteEvent.OnServerEvent:Connect()