Running a remote script which labels the name of the shop including the player and a camera, however it says the name of the shop is nil or just isn’t there, would anyone know why?
On line 32 is the error :
Local Script :
if not game.Players.LocalPlayer.Character then game.Players.LocalPlayer.CharacterAdded:Wait() end
local firstevent = game.ReplicatedStorage:WaitForChild("Remotes"):WaitForChild("NewShop")
local currentCam = workspace.CurrentCamera
local tweenService = game:GetService("TweenService")
function Invisible(TurnsInvisible)
if TurnsInvisible == true then
for i,v in pairs(game.Players.LocalPlayer.Character:GetDescendants()) do
if v:IsA("MeshPart") or v:IsA("Part") or v:IsA("Decal") then
if v ~= game.Players.LocalPlayer.Character.PrimaryPart then
v.Transparency = 1
end
elseif v:IsA("Accessory") then
v:FindFirstChildOfClass("MeshPart").Transparency = 1
end
end
else
for i,v in pairs(game.Players.LocalPlayer.Character:GetDescendants()) do
if v:IsA("MeshPart") or v:IsA("Part") or v:IsA("Decal") then
if v ~= game.Players.LocalPlayer.Character.PrimaryPart then
v.Transparency = 0
end
elseif v:IsA("Accessory") then
v:FindFirstChildOfClass("MeshPart").Transparency = 0
end
end
end
end
firstevent.OnClientEvent:Connect(function(toolCamera,plr,shop)
local ShopGui = game:GetService("ReplicatedStorage"):WaitForChild("Shops"):WaitForChild(shop):WaitForChild("Shop")
local proximityprompt = toolCamera.Parent.ProximityPromptHolder:FindFirstChild("ProximityPrompt")
proximityprompt.Enabled = false
currentCam.CameraType = Enum.CameraType.Scriptable
task.spawn(Invisible,true)
local camSwitch = tweenService:Create(currentCam, TweenInfo.new(1.75), {CFrame = toolCamera.CFrame})
camSwitch:Play()
if not game.Players.LocalPlayer.PlayerGui:FindFirstChild("Shop") then
local gui = ShopGui:Clone()
gui.Parent = script.Parent.Parent
end
end)
ServerScript :
local proximityprompt = script.Parent
local event = game.ReplicatedStorage:WaitForChild("Remotes"):WaitForChild("NewShop")
proximityprompt.Triggered:Connect(function(plr)
local toolCamera = script.Parent.Parent.Parent:FindFirstChild("Camera")
local shop = workspace.Shop.HotDogStand.HotDogStandSans.Name
event:FireClient(plr,toolCamera,shop)
end)
if not game.Players.LocalPlayer.Character then game.Players.LocalPlayer.CharacterAdded:Wait() end
local firstevent = game.ReplicatedStorage:WaitForChild("Remotes"):WaitForChild("NewShop")
local currentCam = workspace.CurrentCamera
local tweenService = game:GetService("TweenService")
local ShopFolder = game:GetService("ReplicatedStorage"):WaitForChild("Shops")
function Invisible(TurnsInvisible)
if TurnsInvisible == true then
for i,v in pairs(game.Players.LocalPlayer.Character:GetDescendants()) do
if v:IsA("MeshPart") or v:IsA("Part") or v:IsA("Decal") then
if v ~= game.Players.LocalPlayer.Character.PrimaryPart then
v.Transparency = 1
end
elseif v:IsA("Accessory") then
v:FindFirstChildOfClass("MeshPart").Transparency = 1
end
end
else
for i,v in pairs(game.Players.LocalPlayer.Character:GetDescendants()) do
if v:IsA("MeshPart") or v:IsA("Part") or v:IsA("Decal") then
if v ~= game.Players.LocalPlayer.Character.PrimaryPart then
v.Transparency = 0
end
elseif v:IsA("Accessory") then
v:FindFirstChildOfClass("MeshPart").Transparency = 0
end
end
end
end
firstevent.OnClientEvent:Connect(function(toolCamera,plr,shop)
local ShopGui = ShopFolder[shop]:WaitForChild("Shop")
local proximityprompt = toolCamera.Parent.ProximityPromptHolder:FindFirstChild("ProximityPrompt")
proximityprompt.Enabled = false
currentCam.CameraType = Enum.CameraType.Scriptable
task.spawn(Invisible,true)
local camSwitch = tweenService:Create(currentCam, TweenInfo.new(1.75), {CFrame = toolCamera.CFrame})
camSwitch:Play()
if not game.Players.LocalPlayer.PlayerGui:FindFirstChild("Shop") then
local gui = ShopGui:Clone()
gui.Parent = script.Parent.Parent
end
end)