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

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

`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

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

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.

2 comments

0

btw CFrame meens coordinate frame.

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)

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