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

Script not working?

Asked by 8 years ago

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)    

0
Localscripts don't work in workspace. GoldenPhysics 474 — 8y
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 :( Volodymyr2004 293 — 8y

1 answer

Log in to vote
2
Answered by 8 years ago

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

Ad

Answer this question