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

No one has been able to answer my question(1 month) can anyone help?

Im making a script where whenever you click q a block goes infront of you and there is a cooldown, it works perfect in rblx studio but not game can anyone help? here is script there is more than one script here: all my code



local eventq = game:GetService("ReplicatedStorage").Remotes.eventq
game:GetService("Players").PlayerAdded:Connect(function(plr)
    local cooldown = Instance.new("NumberValue")
    cooldown.Value = tick()
    cooldown.Name = "Cooldown"
    cooldown.Parent = plr
end)

eventq.OnServerEvent:Connect(function(player, cooldown)
    if tick() - player.Cooldown.Value > cooldown then
        
        player.Cooldown.Value = tick() 
    end
end)



local UIS = game:GetService("UserInputService")
local hotkey = Enum.KeyCode.Q
local cooldown = 10
local event = game:GetService("ReplicatedStorage").Remotes.eventq
local fp = game.Workspace.FIRE 
local plr = game:GetService("Players").LocalPlayer

UIS.InputBegan:Connect(function(input)
    if input.KeyCode == hotkey then
        if tick() - plr.Cooldown.Value > cooldown then
            local fpl = plr.Character:WaitForChild("HumanoidRootPart").Position

            fp.CFrame = CFrame.new(fpl)
            fp.ParticleEmitter.Enabled = true
            event:FireServer(cooldown)
            local timer = 0
            local lastTime = tick()

            while timer < cooldown do -- 10 for max amount of seconds
                timer += tick()-lastTime
                task.wait()
                fp.CFrame = CFrame.new(fpl)
            end
            fp.CFrame = CFrame.new(1721.725, 2511.404, -1099.142)
            fp.ParticleEmitter.Enabled = false
        end
    end
end)



local player = game:GetService("Players").LocalPlayer
local value = player:WaitForChild("Cooldown")
local gui = script.Parent

local cooldown = 10

while wait(0.3) do
    local last = tick() - value.Value
    if last > cooldown then last = cooldown end
    
    local change = 1 - (last/cooldown)
    gui:TweenSize(UDim2.new(1,0,change,0),"In","Linear", 0.3)
end

and no there isnt any errors in game or studio

1 answer

1. Have you updated ROBLOX with the most recent build?

2. The script is a LocalScript, right? (Though it's probably true)

3. Is the game infected with any malware or backdoors?

Finally, 4. It is most likely the result of collaborative editing and drafts.

Draft scripts are saved locally and only ever executed on your studio client as part of collaborative editing. Otherwise, the server copy script is used. You may locate the draft window, right-click, and commit/merge to modify the server copy. Alternately, you can completely disable the feature in Studio's home tab under the game settings> Options (under Home Tab in Studio).

For additional details about Collaborative Editing: https://developer.roblox.com/en-us/articles/Team-Create

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