I’m scripting a game. I made a sword and scripted it. but in Roblox studio, it’s taking damage but in the Roblox game, it’s not taking damage.
Please help.
Thank you
I’m scripting a game. I made a sword and scripted it. but in Roblox studio, it’s taking damage but in the Roblox game, it’s not taking damage.
Please help.
Thank you
What do you mean by only taking damage in studio?
Can you only see the damage?
Please provide your code.
Can you provide more information about your current issue?
It would be helpful if you provided the code. All we can do is assume and hope it’ll make sense to you without the information accommodated to us.
My general guess could be that this is a replication issue. (Damage is being called in a LocalScript but not showing on the server.)
Wait until the player has loaded in studio takes shorter time to load in so the game could have run the script already before loading in
Here is a screen recording of what is happening , give it a look:
in-game:
https://gyazo.com/b3bb72a36fbac7487bbe0820b9ade7c2
Roblox studio:
Anything from the console when in-game (F9)?
Is there any way you could provide additional information? Such as the output and the source code?
Can you send a sample of your code?
local valval = script.Parent.Value.Value
script.Parent.Handle.blade.Touched:Connect(function(hit)
script.Parent.Activated:Connect(function()
valval = 15
if hit.Parent:FindFirstChild("Humanoid") then
hit.Parent.Humanoid:TakeDamage(valval)
script.Parent.combo.Value += 1
script.Disabled = true
wait(0.5)
script.Disabled = false
valval = valval - 15
if script.Parent.combo.Value == 2 then
local stun = hit.Parent.Humanoid:LoadAnimation(script.Parent.stunAnimation)
stun:Play()
script.Parent.combo.Value = script.Parent.combo.Value - 2
end
end
end)
end)
valval is the value of how much damage the sword will do.
nothing in the console.
Can you give us an image of the tool and its contents? For example:
I think the problem is that the “valval” variable isn’t defined correctly.
Try take one value off the variable, so it looks like this:
local valval = script.Parent.Value
EDIT: The value was defined correctly, and i am wrong.
Maybe this doesnt fix things but…
That script you shown. First, is using the Handle of the tool as the Touched part, to deal damage. Is that alright? Maybe using the blade as the touching event?
Then, that script is inside the Tool I think (due to the parent references). So you are applying damage to another player in your own Client Script Side. Maybe, would be better, to send a Remote Event to the Server to apply the damage on that Client.
Everything is on the server.
I dont know what is the problem.
Correct me if Im wrong. I thought we should use a LocalScript inside Tools, not a server script. Idk why, but I always use a LocalScript inside the tool, cause Im trying to get the Activated signal from the Client behaviour. Anyway I will try to use a SeverScript inside the tool to see what happens
EDIT: Yeah it works… I was misunderstanding the tool scripts. I will make more tests :3
I tried this:
local valval = script.Parent.Value
script.Parent.Handle.blade.Touched:Connect(function(hit)
script.Parent.Activated:Connect(function()
valval.Value = 15
if hit.Parent:FindFirstChild("Humanoid") then
hit.Parent.Humanoid:TakeDamage(valval)
script.Parent.combo.Value += 1
script.Disabled = true
wait(0.5)
script.Disabled = false
valval.Value = valval.Value - 15
if script.Parent.combo.Value == 2 then
local stun = hit.Parent.Humanoid:LoadAnimation(script.Parent.stunAnimation)
stun:Play()
script.Parent.combo.Value = script.Parent.combo.Value - 2
end
end
end)
end)
But now its giving me an error:
Unable to cast Instance to float
What line does the error appear on?
I fixed the error. but still does not taking damage.
What i previously said was wrong.