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

How can i make a player do an Slice animation in script?

Heres the local script

I hope its right, (tell me if its not)

So i want it to play an animation in the script after i press E

Local Script:

https://gyazo.com/4e7bf07c141ca5b4970cee40aa95fb25

local Player = game:GetService("Players")

local rp = game:GetService("ReplicatedStorage")
local Lancer = rp:WaitForChild("Lancer")


local UIS = game:GetService("UserInputService")

local debounce = false
local cooldown = 1

UIS.InputBegan:Connect(function(input,isTyping)
	if isTyping then
		return
		
	elseif input.KeyCode == Enum.KeyCode.E and debounce == false then
		debounce = true
	
		Lancer:FireServer()
	

	
	end
end)

Lancer.OnClientEvent:Connect(function()

	wait(cooldown)
	debounce = false
end)

I want it to fire the script in serverscriptservice

this is what i have rn

	local rp = game:GetService("ReplicatedStorage")
	local Lancer = rp:WaitForChild("Lancer")

4 comments

0

^^ thats normal script

0

Are you trying to change the player's animation via Server Script?

0

no lets say a slice animation

0

Well then, try using :LoadAnimation()

1 answer

Hopefully this should work:

local rp = game:GetService("ReplicatedStorage")
local Lancer = rp:WaitForChild("Lancer")
local Animation = AnimationFolderHere:WaitForChild("AnimationNameHere") -- Find the animation

Lancer.OnServerEvent:Connect(function(Player) -- Listen to event fire
	local Character = Player.Character -- Get the player's character
	local Humanoid = Character:FindFirstChild("Humanoid")
	local LoadedAnimation = Humanoid:LoadAnimation(Animation) -- Load the animation
	LoadedAnimation:Play() -- Play the animation
	Lancer:FireClient(Player)
end)

4 comments

0

Hi tysm it helped script works but it only plays once https://gyazo.com/2d72010dd31b46ae69f101513bfb643f what can be the problem

0

Hi tysm it helped script works but it only plays once https://gyazo.com/2d72010dd31b46ae69f101513bfb643f what can be the problem

0

Hmmm

0

The problem is that client is not fired to set the debounce to false, see the updated script.

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