I have a system where you can pick up an item (Chairs) using a proximity prompt inside of it, When the item is picked up I set the parent of the proximity prompt to nil, so the prompt disappears. I also want to remove all other proximity prompts for other items, so the prompts don’t get in the way and also so you can’t pick more than one thing up etc. I only want the prompts to be removed for the player that picks an item up of course so the way I have gone about it is…
LocalPlayer:GetAttributeChangedSignal("Holding"):Connect(function()
if LocalPlayer:GetAttribute("Holding") == "idle" then
local prompt, chair = HoldingFunction:InvokeServer()
prompt.Parent = chair
end
end)
^ChairClient: A local script under StarterPlayerScripts^
--Functions
local function getPrompts(player, prompt, chair)
return prompt, chair
end
*skip ahead in the code
function PickUp:Init()
--Set the prompt up
self.Prompt = self:CreatePrompt()
HoldingFunction.OnServerInvoke = getPrompts(self.Prompt, self.Chair)
self.Prompt.Triggered:Connect(function(...)
if not self.Liftable then return else self.Chair:SetAttribute("Liftable", false) end
self:Press(...)
end)
end
^PickUp: A module script inside ServerScriptService (It uses OOP)
The main problem I am having is that when the game is played, inside of ChairClient, the local script, it returns an error: “attempt to call a Instance value”
Which occurs on line 27:
local prompt, chair = HoldingFunction:InvokeServer()
From what I have seen most people with this error attempted to call brackets like you would with a function on something that is not a function, in my case I do not think that is what is happening, I don’t think it is a syntax error either. I would like help with this, thank you in advance!
TL;DR
ModuleScript:
local function getPrompts(player, prompt, chair)
return prompt, chair
end
HoldingFunction.OnServerInvoke = getPrompts(self.Prompt, self.Chair)
LocalScript:
local prompt, chair = HoldingFunction:InvokeServer()
Local script errors: “attempt to call a Instance value”
