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

Why is my LocalScript not working when I move it to another studio game?

Asked by 3 years ago
Edited 3 years ago

I have two games, game A and game B. I made game A about a month ago and game B just 3 days ago. I created a vending machine model on game A and it worked exactly how I wanted it to work. It uses an animation, a localscript and a soda can model. I moved the vending machine model to game B and the script stopped working despite me putting the animation, the same localscript and soda can model in game B. There were no errors in the output yet it wasn't working at all. I don't think there is a problem with the code, but here it is:

local UIS = game:GetService("UserInputService")
local soda = game.ReplicatedStorage.Soda
local partparent = game.Workspace.VendingMachinepart
local partparent1 = game.Workspace.VendingMachinepart1
local plr = game.Players.LocalPlayer
local char = plr.Character
local root = char.HumanoidRootPart
local hum = char.Humanoid
local sodaanim = game.ReplicatedStorage.GrabSoda
local grabbingsoda = hum:LoadAnimation(sodaanim)
local backpack = plr.Backpack


local function touched()
    partparent.Touched:Connect(function(hit)
        if partparent.Parent:FindFirstChild(char) then
            UIS.InputBegan:Connect(function(input)
                if input.KeyCode == Enum.KeyCode.Q then
                    root.CFrame = CFrame.new(game.VendingMachinepart1.Position)
                    wait()
                    root.Anchored = true
                    wait(1)
                    grabbingsoda:Play()
                    wait(4.12)
                    soda.Parent = backpack
                    if soda.Parent == backpack then
                        script.Disabled = true  
                        root.Anchored = false
                    end
                end
            end)
        end
    end)
end


touched()
0
game a and b need to both be by you WideSteal321 773 — 3y
0
Both games are by me, KPNagai 4 — 3y
0
Where did you put hte localscript ? if you put in workspace it doesnt run there VerdommeMan 1479 — 3y
0
No I put the localscript in startercharacterscripts. KPNagai 4 — 3y
View all comments (4 more)
0
I'm just not sure why it's not working even though there aren't any errors in the output and the script is the same. KPNagai 4 — 3y
0
Try putting some print() and see where does the script stop working. NotTheChara 191 — 3y
0
Ok i'll try it KPNagai 4 — 3y
0
print() doesnt even work. I'm thinking my studio may be broken. KPNagai 4 — 3y

Answer this question