I’m following AlvinBlox’s “How To Make A Game” tutorial, and I’m on part 5 around the hour and seventeen-minute mark. Up until now, I haven’t had any issues. I don’t know anything about coding or scripting, this is how I’m trying to learn.
- What do you want to achieve?
What is supposed to happen with this part of the script, is to make it so when the player equips an item, it’s icon shows up in a box at the bottom left of their screen. But as you can probably figure, this isn’t happening.
- What is the issue?
I don’t even know, honestly. When I click “play” in the studio, I get an error in the output that says Players.fartnvgget.PlayerGui.Shop.Core:143: Expected ')' (to close '(' at line 142), got 'handle'
This doesn’t happen in the video. When I test the game, the shop UI is in its default state without the weapons I added.
- What solutions have you tried so far?
I put an extra ‘)’ at the end of the line before it, and that got rid of the error and made the shop work, but still caused another error about “tables” when I try to equip something. The extra ‘)’ and the new error are both not in the video, which makes me think I’m still doing something wrong? If I get a new error after fixing the first one, there’s still a problem with the code, isn’t there?
I also looked through some stuff on the forums, but none of it seemed like a similar problem to mine or was about different scripts than what I’m trying to do (maybe I missed something? idk).
I even deleted the section and followed the part of the video all over again to see if anything would change. It didn’t.
This is what I have so far, and I don’t think I’m missing anything because this is what AlvinBlox has and it’s working for him:
if equippedItem.Value ~= "" then
local fakeCam = Instance.new("Camera")
fakeCam.Parent = equippedItem
local handle = game.ReplicatedStorage:WaitForChild("ToolModels"):FindFirstChild(availableTools(equippedItem.Value.."Handle"):Clone()
handle.Parent = equippedItemViewport
equippedItemViewport.CurrentCamera = fakeCam
fakeCam.CFrame = handle.CameraCFrame.Value
end
equippedItem:GetPropertyChangedSignal("Value"):Connect(function()
if equippedItem.Value ~= "" then
for _, v in pairs(equippedItemViewport:GetChildren()) do
if not v:IsA("Folder") then
v:Destroy()
end
end
local fakeCam = Instance.new("Camera")
fakeCam.Parent = equippedItem
local handle = game.ReplicatedStorage:WaitForChild("ToolModels"):FindFirstChild(availableTools(equippedItem.Value.."Handle"):Clone()
handle.Parent = equippedItemViewport
equippedItemViewport.CurrentCamera = fakeCam
fakeCam.CFrame = handle.CameraCFrame.Value
else
for _, v in pairs(equippedItemViewport:GetChildren()) do
if not v:IsA("Folder") then
v:Destroy()
end
end
end
end)
I have no idea what I’m supposed to do to fix this since I don’t really know what’s happening. I am extremely confused, overwhelmed, and discouraged.
There might be a simple solution to this and I am just missing it, but I am at the end of my rope so here I am.