I need it so that the game checks if they have the tool equipped, and if they do, upon hitting 'Q' it will fire a ball with particles on it, causing an explosion. Help!
First, you will need an equipped value (Boolean value) and a string value. 1.Name the Boolean value holding, and the String value owner. 2.Use this code:
local player = script.Parent.Parent.Name --Do parent until it reaches the player (not character) script.Parent.Equipped:connect(function(mouse) --parent until it reaches the TOOL script.Parent.owner.value = player wait(0.1) --give it time to work 0.1 seconds if script.Parent.Parent == player then script.Parent.holding.Value = true --Make sure the code knows it is equipped --insert fireball code here else print("Player is not holding this weapon") script.Parent.holding.value = true end)
Noobish scripter here, I know how to, but not that much.
Local script
local player = game.Players.LocalPlayer for i,v in pairs(player.Character:GetChildren()) do if v:IsA("Tool") then print("Player has the tool: " .. v.Name .. " currently equipped!") end end
Marked as Duplicate by KingLoneCat, davness, and TheHospitalDev
This question has been asked before, and already has an answer. If those answers do not fully address your question, then please ask a new question here.
Why was this question closed?