Ad
Log in to vote
0

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

Asked by
O3hros -3
4 days ago
Edited 4 days 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 4 days 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 38
4 days ago
Edited 3 days 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 38 — 3d
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 2465 — 3d

Answer this question