I have this part where if you touch it,it will give you a BoolValue
but if you didn't touch the part.You won't have a BoolValue
that allows you to access this specific Key to make something work.
Now I already got that part down and finished but when you touch the part without pressing the Key before,It doesn't work.
My set-up
local projectile = Instance.new("Part") projectile.Parent = workspace projectile.CFrame = Char.HumanoidRootPart.CFrame
Main
UserInputService.InputBegan:Connect(function(Input, IsTyping) if IsTyping then return end local KeyPressed = Input.KeyCode if KeyPressed == Enum.KeyCode[Key] and Debounce and Char and Char.ChoseFreddy == true then Debounce = false wait(1) Remote:FireServer(Mouse.Hit) wait() Debounce = true end end)
Adding in the Value
local db = true script.Parent.Touched:Connect(function(hit) if db == true then db = false local Can = Instance.new("BoolValue") Can.Name = "CanUse" Can.Value = true Can.Parent = hit.Parent wait(2) db = true end end)
I already made some variables for the ones that are not made by Roblox Studio.
I also just shortened the scripts,so no worries of the functions.I can assure you that I am doing this correctly.