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

Works in studio but not in game?

Asked by 8 years ago

Please provide more explanation in your question. If you explain exactly what you are trying to accomplish, it will be much easier to answer your question correctly.
function mask(key)
    if string.lower(key)=='m' and script.Parent.Folder.Value.Value==1 then
        h = Instance.new("Hat")
        p = game.Workspace.Mask2:clone()
        h.Name = "Space Hat"
        p.Parent = h
        p.Position = script.Parent:FindFirstChild("Head").Position
        p.Name = "Handle" 
        p.formFactor = 0
        p.Size = Vector3.new(2, 0.4, 1) 
        p.BottomSurface = 0 
        p.TopSurface = 0 
        p.Locked = true 
        p.Anchored = false
        h.Parent = script.Parent
        h.AttachmentPos = Vector3.new(0, -0.5, 0.5)
         h.AttachmentUp = Vector3.new(0, 0.147, 0.989)

    end
end
MyMouse=game.Players.LocalPlayer:GetMouse()
MyMouse.KeyDown:connect(mask)
0
Did you place the script client-sided? 'cause this looks like it's a local script. However, it looks like you placed it Server-Sided seeing as you're finding a Head of a Character. KingLoneCat 2642 — 8y
0
What does this have to see with serverside scripts? Local scripts can still access the Workspace. It's just that any changes are not replicated to the server... Link150 1355 — 8y
0
Confusing... Accelital -7 — 8y
0
Is FilteringEnabled set to true? Because it's a real pain if it is, try looking up RemoteEvents and RemoteFunctions. itsJooJoo 195 — 8y
0
dude i found the answer!!! Jumbuu 110 — 8y

2 answers

Log in to vote
0
Answered by
Jumbuu 110
8 years ago

due to some roblox newtork loading complications, sometimes stuff may load faster or slower than the others, even if you use a waitForChild(), the way i fixed it is to make a script to disable and enable it to make it work.

Ad
Log in to vote
-1
Answered by 8 years ago

Make sure that the script is a "LocalScript" Instead of "Script" only if it has "game.Players.LocalPlayer"

Answer this question