Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 2 years ago
Edited 2 years ago
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

Log in to vote
0
Answered by 2 years ago
Edited 2 years ago

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]

Ad
Log in to vote
0
Answered by
MattVSNNL 620 Moderation Voter
2 years ago

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)

Answer this question