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

Script not working?

This script is not firing and by that I mean not even trying. I put a breakpoint on the first line and although it should show up right when i join the game, it just refuses to. This is a local script inside of a model inside of a model inside of workspace. Please review it and tell me what is wrong with it. Do local scripts even work inside of workspace? idk

local part = script.Parent.Parent
local pos=script.Parent.Head.Position
local player = game.Players.LocalPlayer
local mouse = player:GetMouse() --Getting the player's mouse
debounce = false

mouse.Move:connect(function() --When the mouse moves
		local target = mouse.Target
		if not target then
			--do nothing
		elseif target.Name=="Head" then
			print("Hi is this firing")		
			if script.Parent.Parent.Object.Value~="nothing" then
				print("what about thisss")
				debounce=true
				local ghosty=part.GhostObjects:FindFirstChild(part.Object.Value)
				ghosty:MoveTo(pos)
				script.Parent.ghostObjecty.Value=(part.Object.Value)
				debounce=false			
			end
		end
end)	

2 comments

0

Localscripts don't work in workspace.

0

kk Im currently working on putting that script into an old script I have in the starter pack ill have to make some significant changes though :(

1 answer

✓ Accepted answer

GoldenPhysic's comment is correct, LocalScripts don't work in workspace.

They won't run at all if in workspace.

Local Scripts will only run if it's in a designated area. It can be inside the Player's CharacterModel, PlayerGui, PlayerScripts, BackPack, or in the ReplicatedFirst service(Replicates the contents to the client first).

Link to wiki article: http://wiki.roblox.com/index.php?title=API:Class/LocalScript

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