Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Invalid argument #3 (string expected, got Instance)?

local Proximity = script.Parent.Parent.Proximity_Prompt.ProximityPrompt
local Player = game:GetService("Players").LocalPlayer
local CurrentStick = game.Workspace:WaitForChild("CurrentStickFolder").CurrentStickValue
local HitsNeeded = Proximity:WaitForChild("Hits")
local Info = Proximity:WaitForChild("Info")
local HitsValue = Proximity.Parent.Main.Hits
HitsValue.Text = HitsNeeded.Value
Proximity.ActionText = script.Parent.StickToClone.Value
Proximity.ObjectText = Info.Value

Proximity.Triggered:Connect(function()
	CurrentStick.Value = script.Parent.StickToClone.Value
end)

So i got an error on line 8 and probably will have the same in line 12

2 answers

Try to do Proximity.ActionText = tostring(script.Parent.StickToClone.Value) -- This will convert it to a string,

Or it might be Proximity.ActionText = script.Parent.StickToClone.Value.Name

If its a object value, then you will require .Name, if its something like a number. You will require tostring()

[The edit was to fix the inline code]

Hmmm, Maybe try this

local Proximity = script.Parent.Parent.Proximity_Prompt.ProximityPrompt
local Player = game:GetService("Players").LocalPlayer
local CurrentStick = game.Workspace:WaitForChild("CurrentStickFolder").CurrentStickValue
local HitsNeeded = Proximity:WaitForChild("Hits")
local Info = Proximity:WaitForChild("Info")
local HitsValue = Proximity.Parent.Main.Hits
HitsValue.Text = HitsNeeded.Value
Proximity.ActionText = tostring(script.Parent.StickToClone.Value)
Proximity.ObjectText = Info.Value

Proximity.Triggered:Connect(function()
    CurrentStick.Value = tostring(script.Parent.StickToClone.Value)
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.