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

How do I fix an error that says: "string expected, got instance'?

Asked by
O3hros -3
3 years ago
Edited 3 years ago

bool = true local player = game.Players.LocalPlayer local mouse = player:GetMouse() script.Parent.Parent.Parent.Equipped:Connect(function() while bool == true do wait() script.Parent.Text = mouse.Target end end) script.Parent.Parent.Parent.Unequipped:Connect(function() bool = false end)

2 answers

Log in to vote
0
Answered by 3 years ago

You can click the blue circle to format the code better but i believe its because of this line

script.Parent.Text = mouse.Target

you are setting a text property which needs to be a string to the entire object you are targetting, maybe you meant to use mouse.Target.Name

Ad
Log in to vote
0
Answered by
xxaxxaz 42
3 years ago
Edited 3 years ago
local bool = true
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
script.Parent.Parent.Parent.Equipped:Connect(function()
    while bool == true do 
        wait()
        script.Parent.Text = CFrame(mouse.Target.Position)
    end 
end)
script.Parent.Parent.Parent.Unequipped:Connect(function()
    bool = false
end)

this error meens it expected to get a string but instead got a int.

0
btw CFrame meens coordinate frame. xxaxxaz 42 — 3y
0
thats not how you use cframe, thats not what he wants and thats not how you spell (im being a hypocrite when i said that) greatneil80 2647 — 3y

Answer this question