Hello! I am making a boat shop and have been having this error, I do not know how to fix it so I came here.
I have has this error for the past 2 days [ServerScriptService.Script:14:
I tried all yesterday to find a solution to no prevail.
The script below is the problem
>>>This line is the issue return game.ServerStorage.Boats:FindFirstChild(NameOfBoat).Price.Value
end
game.ReplicatedStorage:WaitForChild("SpawnBoat").OnServerEvent:Connect(function(player, NameOfBoat)
local boat = game.ServerStorage.Boats:FindFirstChild(NameOfBoat):Clone()
boat:SetPrimaryPartCFrame(player.Character.HumanoidRootPart.CFrame + Vector3.new(3, 10, -9))
boat.Parent = workspace
boat:MakeJoints()
boat.Name = player.Name.."'s ".. NameOfBoat
end)
If anybody knows what the problem is please let me know!
Can you use ``` to insert your code as I’d be able to read it better please. I can’t see price anywhere on that, so can you screenshot the error and give us the whole code and script name.
It is the name of the boat in question. There is a Boats folder in ServerStorage and NameOfBoat defines the name of the boat that I am targeting inside that folder.
if script.Parent.Parent.Purchased == true then
--Spawn It
game.ReplicatedStorage.SpawnBoat:FireServer(script.Parent.Parent.Name)
else
--Let the player buy the item
local PriceOfItem = game.ReplicatedStorage:WaitForChild("CheckPrice"):InvokeServer(script.Parent.Parent.Name)
if game.Players.LocalPlayer.leaderstats.Gold.Value >= PriceOfItem and script.Parent.Parent.Purchased.Value == false then
-- The player has enough gold
game.Players.LocalPlayer.leaderstats.Gold.Value = game.Players.LocalPlayer.leaderstats.Gold.Value - PriceOfItem
script.Parent.Parent.Purchased.Value = true
end
end
end)