- What do you want to achieve? Keep it simple and clear!
I want the enemies being damaged when my gun shoots at them in my game.
- What is the issue? Include screenshots / videos if possible!
Even though my gun works perfectly, the enemies don’t have decreasing health at all. I cannot include a video though because the MB is too much and a screenshot will not work for this. Humanoids are already implemented in the enemies since it is a free model I am using.
- What solutions have you tried so far? Did you look for solutions on the Creator Hub?
I tried making a bug report about this even though it was shortly taken down because it shouldn’t be reported there. And I don’t really think Creator Hub can help me with this.
(If this is the wrong category or sub-category, please post a reply on this topic saying the right category and right sub-category and I will try to change it to that immediately if I am online!)
Can you please include the code for the gun? Without it we can’t do much.
Is there a section of the gun code that checks if it’s a player?
To include a video, you can upload it to youtube and set the video visibility to unlisted, then send the link to t.
1 Like
Well eh its a gun from the roblox FPS template I took, so there probably isn’t a section of the gun code that checks if it is a player. Plus I ain’t uploading a video to Youtube for this because why?
We still don’t have enough information to help.
Can you please send the code for the gun?
(The reason for uploading a video to youtube is to better show the issue - by doing it on Youtube you don’t have any size restrictions)
You need to make the other player take damage on server-side scripts, because if you do it in client-side script, it won’t make anything
Guys I need a response from y’all otherwise there is no point in this topic, @PlayerProfissional_1 But I need the specific script locations and I need you to be really specific with your response.
@SeargentAUS Do you want me to put the code from the gun model itself or the code for the gun model in ReplicatedStorage, I need answers now otherwise my game will be further delayed in release all because of one small bug that no one is helping me to fix. (Btw I deleted 2 posts that were replies to you guys so I can address them a little more here.)
This sounds like a classic and common case, in fact I’ve actually made this mistake several times too. What likely happens is the damage isn’t firing from the server, and it’s firing from the client. What I recommend is using RemoteEvents, unless you followed a certain tutorial; or you have the script.
Please send the script, as we cannot do much right now.
But if I were to guess, if it is a local script then:
local tool = script.Parent
local gunfireEvent = tool:WaitForChild("FireWeapon")
tool.Activated:Connect(function()
gunfireEvent:FireServer()
-- whatever else was in here that affiliates to damage should go into a server script.
end)
And as for a server script:
local tool = script.Parent
local gunFired = tool:WaitForChild("FireWeapon")
gunFired.OnServerEvent:Connect(function()
-- damage should go here
end)
This is just to give you an idea. However, the server side can also detect if the tool is activated.
We have zero code. We cannot help you or “point out specific locations” since we don’t even know those locations.
All we can say is that there’s something wrong with the damage code.
Maybe, the damage code can only damage players, maybe its dealing damage from the client and not the server. We don’t know.
If the model you’re using is an old model, odds are it’s dealing damage from the client and thus, not working. For it to work, you need to use RemoteEvents
to tell the server to deal damage.
If its a newer model, then it may REQUIRE setup that is specific to your games setup, and its not working because you have failed to set it up correctly.
Although, we cannot specifically help you because you have not provided code, and we aren’t exactly bothered searching through the toolbox to find the ONE super specific model you’re talking about.
If you’re unable to debug the issue based on what we’re giving you, I’m going to be completely honest, you should be asking yourself if you should even be attempting to make anything but super simple systems with tutorial videos.
UPDATE: The GUI isn’t showing up anymore either, I think I messed one of the scripts for it up by accidentally clicking on it. I am thinking about replacing the entire weapons with something else but idk really know how that will work out as I don’t wanna use a free model because copyright issues.
Also, I’ll add that free models, are as the name implies, free to use. Unless if the model is something protected by copyright (Such as a 1:1 Lamborghini, Sonic the Hedgehog, or Super Mario) then its completely fine to use them.
If a part of a free-model uses branded material or stolen assets, then you can get in hot water with copyright, else you can’t get struck.
Inside the gun, you need to have a SERVER-SIDE script, and in it, you need to wait for when player use the tool, call a remote function, and a LOCAL-SIDE script that is also inside the gun will give back mouse.Target, then in the SERVER-SIDE script, you make the damage, like: Target.Parent.Humanoid:TakeDamage(10)
You also will need to check if Target.Parent is a player character, and see if humanoid ~= nil